seawolf2357 commited on
Commit
8c510f9
โ€ข
1 Parent(s): e27cfc9

initial commit

Browse files
Files changed (1) hide show
  1. app.py +8 -37
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="Enter your prompt here...", label="Prompt:", type="text"),
49
- gr.Textbox(lines=1, placeholder="Enter the URL here...", label="URL to parse:", type="text"),
50
- gr.Textbox(lines=1, placeholder="Enter your API-key here...", 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=[["Summarize the following text as a list:","https://blog.google/outreach-initiatives/google-org/our-commitment-on-using-ai-to-accelerate-progress-on-global-development-goals/","",0.3],
55
- ["Generate a summary of the following text. Give me an overview of main business impact from the text following this template:\n- Summary:\n- Business Impact:\n- Companies:", "https://ai.googleblog.com/2019/10/quantum-supremacy-using-programmable.html","",0.7]
 
56
  ],
57
- title="Information Extraction with ChatGPT Interface:",
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