Spaces:
Build error
Build error
Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# -*- coding: utf-8 -*-
|
2 |
+
"""Test deploying model on huggingface space.ipynb
|
3 |
+
|
4 |
+
Automatically generated by Colaboratory.
|
5 |
+
|
6 |
+
Original file is located at
|
7 |
+
https://colab.research.google.com/drive/1VRB3YKw0bl47Lp_CuxXwyCsU9JGXq3sY
|
8 |
+
"""
|
9 |
+
|
10 |
+
|
11 |
+
import gradio as gr
|
12 |
+
from transformers import pipeline
|
13 |
+
|
14 |
+
translation = pipeline(model="Shularp/krirk-finetuned-Helsinki-NLP_opus-mt-ar-en")
|
15 |
+
|
16 |
+
def translate(text):
|
17 |
+
result = translation(text)
|
18 |
+
return result
|
19 |
+
|
20 |
+
|
21 |
+
|
22 |
+
description = "Arabic-English translation machine"
|
23 |
+
title = "Translate"
|
24 |
+
|
25 |
+
|
26 |
+
interface = gr.Interface(fn=translate, inputs="text", outputs=["text"],
|
27 |
+
description=description)
|
28 |
+
|
29 |
+
interface.launch()
|
30 |
+
|