Update app.py
Browse files
app.py
CHANGED
|
@@ -14,4 +14,29 @@ textbox = gr.Textbox(label="Type your review", placeholder="example: good place
|
|
| 14 |
gr.Interface(
|
| 15 |
get_sentiment,
|
| 16 |
textbox, #'text',
|
| 17 |
-
"text").launch(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
gr.Interface(
|
| 15 |
get_sentiment,
|
| 16 |
textbox, #'text',
|
| 17 |
+
"text").launch()
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
### TRanslation
|
| 21 |
+
en_to_fr = pipeline("translation", model="Helsinki-NLP/opus-mt-en-fr")
|
| 22 |
+
def translate(input):
|
| 23 |
+
return en_to_fr(input)
|
| 24 |
+
|
| 25 |
+
textbox = gr.Textbox(label="Type your original text", placeholder="example: blah blah", lines=2)
|
| 26 |
+
|
| 27 |
+
gr.Interface(
|
| 28 |
+
translate,
|
| 29 |
+
textbox, #'text',
|
| 30 |
+
"text").launch()
|
| 31 |
+
|
| 32 |
+
|
| 33 |
+
####
|
| 34 |
+
img_to_text = pipeline(model="ydshieh/vit-gpt2-coco-en")
|
| 35 |
+
def img_text(img):
|
| 36 |
+
return img_to_text(img)
|
| 37 |
+
|
| 38 |
+
img = gr.Image()
|
| 39 |
+
gr.Interface(
|
| 40 |
+
img_to_text,
|
| 41 |
+
img, #'text',
|
| 42 |
+
"text").launch()
|