franco-bach commited on
Commit
88bfebd
1 Parent(s): 6ea1e5e

add: poetry env and gradio interface

Browse files
Files changed (3) hide show
  1. app.py +20 -10
  2. poetry.lock +0 -0
  3. pyproject.toml +16 -0
app.py CHANGED
@@ -1,16 +1,26 @@
1
- from transformers import pipeline
2
  import gradio as gr
 
3
 
4
 
5
- model = pipeline(
6
- "summarization",
7
- )
 
 
 
8
 
9
- def predict(prompt):
10
- summary = model(prompt)[0]["summary_text"]
11
- return summary
12
 
 
13
 
14
- # create an interface for the model
15
- with gr.Interface(predict, "textbox", "text") as interface:
16
- interface.launch()
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ import requests
3
 
4
 
5
+ def post_request(text: str, speaker: str):
6
+
7
+ post_request = {
8
+ "text": text,
9
+ "speaker": speaker,
10
+ }
11
 
12
+ response = requests.post(..., json=post_request)
 
 
13
 
14
+ return response
15
 
16
+
17
+ iface = gr.Interface(
18
+ fn=post_request,
19
+ inputs=[
20
+ gr.Textbox(label="Texto a sintetizar", type="text", lines=5, placeholder="Ingresa aquí el texto"),
21
+ gr.Dropdown(label="Hablante", choices=["Fem1", "Fem2", "Fem3", "Mas1", "Mas2", "Mas3"], type="value"),
22
+ ],
23
+ outputs=[
24
+ gr.Audio(label="Audio generado"),
25
+ ],
26
+ )
poetry.lock ADDED
The diff for this file is too large to render. See raw diff
 
pyproject.toml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [tool.poetry]
2
+ name = "sintetica-staging"
3
+ version = "0.1.0"
4
+ description = "Sintetica staging in Hugging Face"
5
+ authors = ["francobach47 <francobach47@gmail.com>"]
6
+ readme = "README.md"
7
+
8
+ [tool.poetry.dependencies]
9
+ python = "^3.9"
10
+ gradio = "^4.13.0"
11
+ requests = "^2.31.0"
12
+
13
+
14
+ [build-system]
15
+ requires = ["poetry-core"]
16
+ build-backend = "poetry.core.masonry.api"