VeuReu commited on
Commit
4557fc4
verified
1 Parent(s): 413fec6

Update schat_client.py

Browse files
Files changed (1) hide show
  1. schat_client.py +18 -19
schat_client.py CHANGED
@@ -6,10 +6,9 @@ from typing import Any, Dict, List, Optional, Tuple, Union
6
  import requests
7
  import json
8
 
9
- # Lazy initialization to avoid crash if Space is down at import time
10
  _schat_client = None
11
 
12
-
13
  def _get_schat_client():
14
  """Get or create the svision client (lazy initialization)."""
15
  global _schat_client
@@ -18,51 +17,51 @@ def _get_schat_client():
18
  return _schat_client
19
 
20
  def get_from_prompt(prompt):
 
21
  client = _get_schat_client()
22
 
23
  result = client.predict(
24
- prompt=prompt,
25
- api_name="/generate_out_from_prompt"
26
  )
27
 
28
  return result
29
 
30
-
31
- def resumir_frases_salamandra(frase, num_palabras):
32
  """
33
- Llama al endpoint /resumir del Space remoto VeuReu/schat
34
  """
35
  client = _get_schat_client()
36
 
37
  result = client.predict(
38
- frase=frase,
39
- num_palabras=num_palabras,
40
- api_name="/resumir"
41
  )
42
 
43
  return result
44
 
45
- def identificar_personajes (frase, personas):
46
  """
47
- Llama al endpoint /modificar del Space remoto VeuReu/schat
48
  """
49
  client = _get_schat_client()
50
 
51
  result = client.predict(
52
- frase=frase,
53
- persona = personas,
54
- api_name="/modificar"
55
  )
56
  return result
57
 
58
- def free_narration_schat(texto):
59
  """
60
- Llama al endpoint /narraci贸 del Space remoto VeuReu/schat
61
  """
62
  client = _get_schat_client()
63
 
64
  result = client.predict(
65
- srt_final=texto,
66
  api_name="/narraci贸"
67
  )
68
- return result
 
6
  import requests
7
  import json
8
 
9
+ # Lazy initialization to avoid crash if the Space is down at import time
10
  _schat_client = None
11
 
 
12
  def _get_schat_client():
13
  """Get or create the svision client (lazy initialization)."""
14
  global _schat_client
 
17
  return _schat_client
18
 
19
  def get_from_prompt(prompt):
20
+ """Send a prompt to the /generate_out_from_prompt endpoint."""
21
  client = _get_schat_client()
22
 
23
  result = client.predict(
24
+ prompt=prompt,
25
+ api_name="/generate_out_from_prompt"
26
  )
27
 
28
  return result
29
 
30
+ def summarize_sentences_salamandra(sentence, num_words):
 
31
  """
32
+ Calls the /resume endpoint of the remote VeuReu/schat Space.
33
  """
34
  client = _get_schat_client()
35
 
36
  result = client.predict(
37
+ sentence=sentence,
38
+ num_words=num_words,
39
+ api_name="/resume"
40
  )
41
 
42
  return result
43
 
44
+ def identify_characters(sentence, person):
45
  """
46
+ Calls the /modificat endpoint of the remote VeuReu/schat Space.
47
  """
48
  client = _get_schat_client()
49
 
50
  result = client.predict(
51
+ sentence=sentence,
52
+ person=person,
53
+ api_name="/modificat"
54
  )
55
  return result
56
 
57
+ def free_narration_schat(srt_text):
58
  """
59
+ Calls the /narracio endpoint of the remote VeuReu/schat Space.
60
  """
61
  client = _get_schat_client()
62
 
63
  result = client.predict(
64
+ srt_text=srt_text,
65
  api_name="/narraci贸"
66
  )
67
+ return result