Spaces:
Runtime error
Runtime error
Update main.py
Browse files
main.py
CHANGED
@@ -1,93 +1,4 @@
|
|
1 |
-
import matplotlib.pyplot as plt
|
2 |
-
import numpy as np
|
3 |
-
#
|
4 |
-
# result=[(0, 1), (1, 3), (4, 4), (8, 3), (10, 6), (12, 3), (14, 2), (16, 1), (17, 0)]
|
5 |
-
# y=[]
|
6 |
-
# print(result)
|
7 |
-
# x=[]
|
8 |
-
# start = []
|
9 |
-
# end = []
|
10 |
-
# for i in range(len(result)-1):
|
11 |
-
# #x1=(result1[i][0],result1[i+1][0])
|
12 |
-
# for j in range(result[i][0],result[i+1][0]):
|
13 |
-
# x.append(j)
|
14 |
-
# y.append(result[i][1])
|
15 |
-
# x.append(17)
|
16 |
-
# y.append(0)
|
17 |
-
# print(x)
|
18 |
-
# print(y)
|
19 |
-
# plt.bar(x,y,width=2)
|
20 |
-
# plt.xlabel("X-coordinate")
|
21 |
-
# plt.ylabel("Height")
|
22 |
-
# plt.title("Skyline")
|
23 |
-
# plt.show()
|
24 |
-
# print(x)
|
25 |
-
# print(y)
|
26 |
-
# import gradio as gr
|
27 |
-
#
|
28 |
-
# from transformers import pipeline
|
29 |
|
30 |
-
#
|
31 |
-
# import gradio as gr
|
32 |
-
# from transformers import pipeline
|
33 |
-
# from googletrans import Translator
|
34 |
-
# pipe = pipeline("translation_en_to_zh", model="t5-base", framework="tf")
|
35 |
-
# translator = Translator(service_urls=['translate.google.com'])
|
36 |
-
#
|
37 |
-
#
|
38 |
-
#
|
39 |
-
#
|
40 |
-
#
|
41 |
-
# def translate(text):
|
42 |
-
# result = translator.translate(text, dest='zh-CN')
|
43 |
-
# return result.text
|
44 |
-
#
|
45 |
-
# with gr.Blocks() as demo:
|
46 |
-
# with gr.Row():
|
47 |
-
# with gr.Column():
|
48 |
-
# english = gr.Textbox(label="English text")
|
49 |
-
# translate_btn = gr.Button(value="Translate")
|
50 |
-
# with gr.Column():
|
51 |
-
# chinese = gr.Textbox(label="Chinese Text")
|
52 |
-
#
|
53 |
-
# # translate_btn.click(translate, inputs=english, outputs=chinese, api_name="translate-to-chinese", share=True)
|
54 |
-
# with gr.Interface(fn=translate, inputs=gr.inputs.Textbox(label="English text"),
|
55 |
-
# outputs=gr.outputs.Textbox(label="Chinese Text"),port=8888) as demo:
|
56 |
-
# demo.launch(share=True)
|
57 |
-
# examples = gr.Examples(examples=["I went to the supermarket yesterday.", "Helen is a good swimmer."],
|
58 |
-
# inputs=[english])
|
59 |
-
#
|
60 |
-
#
|
61 |
-
#
|
62 |
-
# demo.launch()
|
63 |
-
|
64 |
-
# import gradio as gr
|
65 |
-
# from transformers import pipeline
|
66 |
-
# import transformers
|
67 |
-
# import os
|
68 |
-
#
|
69 |
-
# os.environ["HUGGINGFACE_API_TOKEN"] = "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"
|
70 |
-
#
|
71 |
-
# pipe = pipeline("translation", model="t5-base-zh-to-en", api_name="t5-base")
|
72 |
-
#
|
73 |
-
# def translate(text):
|
74 |
-
# return pipe(text)[0]["translation_text"]
|
75 |
-
#
|
76 |
-
# with gr.Interface(fn=translate, inputs="text", outputs="text", layout="vertical",
|
77 |
-
# title="英文翻译成中文", description="使用Hugging Face的transformers库进行翻译") as iface:
|
78 |
-
# iface.launch()
|
79 |
-
# import gradio as gr
|
80 |
-
# from transformers import pipeline
|
81 |
-
#
|
82 |
-
# pipe = pipeline("translation_en_to_zh", model="t5-base", framework="tf")
|
83 |
-
#
|
84 |
-
#
|
85 |
-
# def translate(text):
|
86 |
-
# return pipe(text)[0]["translation_text"]
|
87 |
-
#
|
88 |
-
#
|
89 |
-
# with gr.Interface(fn=translate, inputs=gr.inputs.Textbox(label="English text"), outputs=gr.outputs.Textbox(label="Chinese Text")) as demo:
|
90 |
-
# demo.launch()
|
91 |
|
92 |
import gradio as gr
|
93 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
import gradio as gr
|
4 |
|