Spaces:
Sleeping
Sleeping
esquilibria
Browse files- .gitignore +1 -0
- app.py +24 -0
- requirements.txt +3 -0
.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
venv/
|
app.py
CHANGED
|
@@ -1,7 +1,31 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
def greet(name):
|
| 4 |
return "Hello " + name + "!!"
|
| 5 |
|
| 6 |
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 7 |
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
pipe = pipeline("text-generation", model="hmnshudhmn24/personal-fitness-assistant-nlp")
|
| 5 |
|
| 6 |
def greet(name):
|
| 7 |
return "Hello " + name + "!!"
|
| 8 |
|
| 9 |
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 10 |
demo.launch()
|
| 11 |
+
|
| 12 |
+
def convertir_texto(texto):
|
| 13 |
+
resultado = pipe(
|
| 14 |
+
texto,
|
| 15 |
+
max_length=10000)
|
| 16 |
+
print(resultado) # Para depuración
|
| 17 |
+
return resultado[0]["generated_text"]
|
| 18 |
+
|
| 19 |
+
demo = gr.Interface(
|
| 20 |
+
fn=convertir_texto,
|
| 21 |
+
inputs=gr.Textbox(lines=10, label="Texto a simplificar"),
|
| 22 |
+
outputs=gr.Textbox(lines=10, label="Texto simplificado"),
|
| 23 |
+
title="Simplificación de textos médicos con mT5",
|
| 24 |
+
description="Introduce texto en español y obtén una versión simplificada.",
|
| 25 |
+
article="Este modelo está entrenado para simplificar textos medicos.",
|
| 26 |
+
submit_btn="Comprobar",
|
| 27 |
+
fill_width=True
|
| 28 |
+
)
|
| 29 |
+
demo.launch(
|
| 30 |
+
theme= gr.themes.Glass()
|
| 31 |
+
)
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio==6.0.2
|
| 2 |
+
transformers==4.49.0
|
| 3 |
+
torch==2.6.0
|