Spaces:
Sleeping
Sleeping
app
Browse files
app.py
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import random
|
| 3 |
from smolagents import GradioUI, CodeAgent, HfApiModel
|
|
@@ -35,4 +55,6 @@ if __name__ == "__main__":
|
|
| 35 |
response = alfred.run("What is Facebook and what's their most popular model?")
|
| 36 |
|
| 37 |
print("🎩 Alfred's Response:")
|
| 38 |
-
print(response)
|
|
|
|
|
|
|
|
|
| 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()
|
| 17 |
+
|
| 18 |
+
"""
|
| 19 |
+
|
| 20 |
+
|
| 21 |
import gradio as gr
|
| 22 |
import random
|
| 23 |
from smolagents import GradioUI, CodeAgent, HfApiModel
|
|
|
|
| 55 |
response = alfred.run("What is Facebook and what's their most popular model?")
|
| 56 |
|
| 57 |
print("🎩 Alfred's Response:")
|
| 58 |
+
print(response)
|
| 59 |
+
|
| 60 |
+
"""
|