Spaces:
Runtime error
Runtime error
Commit
·
b934ee9
1
Parent(s):
1b215c9
added test for models
Browse files
app.py
CHANGED
|
@@ -1,23 +1,16 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
|
| 4 |
-
# Add your search logic here
|
| 5 |
-
results = ["Result 1", "Result 2", "Result 3"]
|
| 6 |
-
return "\n".join(results)
|
| 7 |
|
| 8 |
-
|
| 9 |
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
input_text = gr.Textbox("text", label="Enter your search query:")
|
| 13 |
-
default_options = gr.Radio("text", label="Default Options", choices=["Option 1", "Option 2", "Option 3"])
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
with gr.Column():
|
| 21 |
-
strategy_3 = gr.Checkbox("text", label="Strategy 3", choices=["ChatGPT", "LLaMA", "Vicuna", "Alpaca", "Flan-T5"])
|
| 22 |
|
| 23 |
-
demo.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
+
from transformers import pipeline
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
+
pipe = pipeline("translation", model="Helsinki-NLP/opus-mt-en-es")
|
| 6 |
|
| 7 |
+
def predict(text):
|
| 8 |
+
return pipe(text)[0]["translation_text"]
|
|
|
|
|
|
|
| 9 |
|
| 10 |
+
demo = gr.Interface(
|
| 11 |
+
fn=predict,
|
| 12 |
+
inputs='text',
|
| 13 |
+
outputs='text',
|
| 14 |
+
)
|
|
|
|
|
|
|
| 15 |
|
| 16 |
+
demo.launch()
|