refactoring code
Browse files- .gitignore +2 -0
- README.md +1 -1
- app.py +15 -4
- requirements.txt +1 -0
- test_bot/Gradio_Test.py +23 -0
.gitignore
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.pyc
|
| 2 |
+
.env
|
README.md
CHANGED
|
@@ -10,4 +10,4 @@ pinned: false
|
|
| 10 |
license: apache-2.0
|
| 11 |
---
|
| 12 |
|
| 13 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 10 |
license: apache-2.0
|
| 11 |
---
|
| 12 |
|
| 13 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
|
|
|
| 1 |
+
# import gradio as gr
|
| 2 |
+
#
|
| 3 |
+
# def greet(name):
|
| 4 |
+
# return "Hello ...." + name + "!!"
|
| 5 |
+
#
|
| 6 |
+
# iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 7 |
+
# iface.launch()
|
| 8 |
+
|
| 9 |
import gradio as gr
|
| 10 |
|
| 11 |
+
from test_bot.Gradio_Test import Gradio_Test
|
| 12 |
+
|
| 13 |
+
gradio_test = Gradio_Test()
|
| 14 |
+
|
| 15 |
+
demo = gradio_test.create_demo()
|
| 16 |
|
| 17 |
+
if __name__ == "__main__":
|
| 18 |
+
demo.launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
gradio
|
test_bot/Gradio_Test.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
|
| 3 |
+
class Gradio_Test:
|
| 4 |
+
|
| 5 |
+
def __init__(self):
|
| 6 |
+
pass
|
| 7 |
+
|
| 8 |
+
def title(self):
|
| 9 |
+
return "# An title .. (testing deployment) "
|
| 10 |
+
|
| 11 |
+
def create_demo(self):
|
| 12 |
+
title = self.title()
|
| 13 |
+
|
| 14 |
+
with gr.Blocks() as demo:
|
| 15 |
+
gr.Markdown(title)
|
| 16 |
+
inp = gr.Textbox(placeholder="What is your name?")
|
| 17 |
+
out = gr.Textbox()
|
| 18 |
+
|
| 19 |
+
inp.change(fn=lambda x: f"Welcome .... , {x}!",
|
| 20 |
+
inputs=inp,
|
| 21 |
+
outputs=out)
|
| 22 |
+
|
| 23 |
+
return demo
|