Spaces:
Runtime error
Runtime error
seawolf2357
commited on
Commit
โข
8c510f9
1
Parent(s):
e27cfc9
initial commit
Browse files
app.py
CHANGED
@@ -45,53 +45,24 @@ def flip_text(request, page_url, contraseรฑa, temp):
|
|
45 |
# define the gradio interface
|
46 |
iface = gr.Interface(
|
47 |
fn=flip_text,
|
48 |
-
inputs=[gr.Textbox(lines=1, placeholder="
|
49 |
-
gr.Textbox(lines=1, placeholder="
|
50 |
-
gr.Textbox(lines=1, placeholder="
|
51 |
gr.Slider(0.0,1.0, value=0.3, label="Temperature:")
|
52 |
],
|
53 |
outputs=[gr.Textbox(label="Input:"), gr.Textbox(label="Output:"), gr.Textbox(label="Tokens:")],
|
54 |
-
examples=[["
|
55 |
-
["
|
|
|
56 |
],
|
57 |
-
title="
|
58 |
# description="This tool allows querying the text retrieved from the URL using OpenAI's [text-davinci-003] engine.\nThe URL text can be referenced in the prompt as \"following text\".\nA GPT2 tokenizer is included to ensure that the 2000 token limit for OpenAI queries is not exceeded. Provide a prompt with your request, the url for text retrieval, your api-key and temperature to process the text."
|
59 |
)
|
60 |
|
61 |
-
|
62 |
-
|
63 |
error_message = ""
|
64 |
|
65 |
try:
|
66 |
iface.launch()
|
67 |
except Exception as e:
|
68 |
error_message = "An error occurred: " + str(e)
|
69 |
-
iface.outputs[1].value = error_message
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
def flip_image(x):
|
75 |
-
return np.fliplr(x)
|
76 |
-
|
77 |
-
|
78 |
-
with gr.Blocks() as demo:
|
79 |
-
gr.Markdown("Flip text or image files using this demo.")
|
80 |
-
with gr.Tab("Flip Text"):
|
81 |
-
text_input = gr.Textbox()
|
82 |
-
text_output = gr.Textbox()
|
83 |
-
text_button = gr.Button("Flip")
|
84 |
-
with gr.Tab("Flip Image"):
|
85 |
-
with gr.Row():
|
86 |
-
image_input = gr.Image()
|
87 |
-
image_output = gr.Image()
|
88 |
-
image_button = gr.Button("Flip")
|
89 |
-
|
90 |
-
with gr.Accordion("Open for More!"):
|
91 |
-
gr.Markdown("Look at me...")
|
92 |
-
|
93 |
-
text_button.click(flip_text, inputs=text_input, outputs=text_output)
|
94 |
-
image_button.click(flip_image, inputs=image_input, outputs=image_output)
|
95 |
-
|
96 |
-
if __name__ == "__main__":
|
97 |
-
demo.launch()
|
|
|
45 |
# define the gradio interface
|
46 |
iface = gr.Interface(
|
47 |
fn=flip_text,
|
48 |
+
inputs=[gr.Textbox(lines=1, placeholder="๋ถ์ํ๋ผ:", label="ํ๋กฌํํธ:", type="text"),
|
49 |
+
gr.Textbox(lines=1, placeholder="URL์ ๋ถ์ฌ ๋ฃ์ผ์ธ์: ", label="URL ๋ถ์ฌ๋ฃ๊ธฐ:", type="text"),
|
50 |
+
gr.Textbox(lines=1, placeholder="์น์ธ๋ API-key๋ฅผ ์
๋ ฅํ์ธ์.", label="API-Key:", type="password"),
|
51 |
gr.Slider(0.0,1.0, value=0.3, label="Temperature:")
|
52 |
],
|
53 |
outputs=[gr.Textbox(label="Input:"), gr.Textbox(label="Output:"), gr.Textbox(label="Tokens:")],
|
54 |
+
examples=[["๊ธฐ์ฌ๋ฅผ ์์ฝํ๋ผ:","http://korating.com/news/view.php?idx=7573","",0.7],
|
55 |
+
["ํ๊ธ๋ก ๋ฒ์ญํ๋ผ:\n- ์์ฝ:\n- ๋น์ฆ๋์ค ์ํฅ๋:\n- ํฌ์ ๊ฐ์น:", "https://ai.googleblog.com/2019/10/quantum-supremacy-using-programmable.html","",0.7],
|
56 |
+
["์ข
๋ชฉ ๋ถ์ ์์ฝํ๋ผ:","https://securities.miraeasset.com/bbs/board/message/view.do?messageId=2297456&messageNumber=492&messageCategoryId=0&startId=zzzzz%7E&startPage=1&curPage=1&searchType=2&searchText=&searchStartYear=2022&searchStartMonth=02&searchStartDay=01&searchEndYear=2023&searchEndMonth=02&searchEndDay=01&lastPageFlag=&vf_headerTitle=&categoryId=1545","",0.7]
|
57 |
],
|
58 |
+
title="AI DEMO: ํ๊ธ ๋ฐ ๋ค๊ตญ์ด ์ง์ + ChatGPT + ๋ฉํฐ ๋ชจ๋ธ ๋ฐ ๋ฐ์ดํฐ์
๊ธฐ๋ฐ ์์ฉ ์๋น์ค",
|
59 |
# description="This tool allows querying the text retrieved from the URL using OpenAI's [text-davinci-003] engine.\nThe URL text can be referenced in the prompt as \"following text\".\nA GPT2 tokenizer is included to ensure that the 2000 token limit for OpenAI queries is not exceeded. Provide a prompt with your request, the url for text retrieval, your api-key and temperature to process the text."
|
60 |
)
|
61 |
|
|
|
|
|
62 |
error_message = ""
|
63 |
|
64 |
try:
|
65 |
iface.launch()
|
66 |
except Exception as e:
|
67 |
error_message = "An error occurred: " + str(e)
|
68 |
+
iface.outputs[1].value = error_message
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|