Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -50,22 +50,46 @@ def chatbot_stream(user_input):
|
|
50 |
response += text_chunk
|
51 |
yield response
|
52 |
|
53 |
-
# Gradio UI with
|
54 |
def ui():
|
55 |
-
with gr.Blocks() as app:
|
56 |
-
gr.
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
app.launch(share=True)
|
70 |
|
71 |
ui()
|
|
|
50 |
response += text_chunk
|
51 |
yield response
|
52 |
|
53 |
+
# Gradio UI with enhanced chat interface
|
54 |
def ui():
|
55 |
+
with gr.Blocks(theme=gr.themes.Glass(primary_hue="violet", secondary_hue="emerald", neutral_hue="stone")) as app:
|
56 |
+
with gr.Tabs():
|
57 |
+
with gr.TabItem("💬Chat"):
|
58 |
+
gr.Markdown("# AI Storyboard & Chatbot")
|
59 |
+
chatbot = gr.Chatbot(label="Storyboard Chatbot")
|
60 |
+
with gr.Row():
|
61 |
+
chat_input = gr.Textbox(
|
62 |
+
label="Your Message",
|
63 |
+
placeholder="Type your question here...",
|
64 |
+
lines=1
|
65 |
+
)
|
66 |
+
send_button = gr.Button("✋Ask Question")
|
67 |
+
|
68 |
+
# Quick question examples
|
69 |
+
quick_questions = ["How do I structure a storyboard?", "What makes a good visual scene?", "How to add depth to a story?"]
|
70 |
+
with gr.Row():
|
71 |
+
for question in quick_questions:
|
72 |
+
gr.Button(question, variant="secondary").click(lambda q=question: chatbot_stream(q), inputs=None, outputs=chatbot)
|
73 |
+
|
74 |
+
# Chatbot functionality
|
75 |
+
send_button.click(
|
76 |
+
fn=chatbot_stream,
|
77 |
+
inputs=chat_input,
|
78 |
+
outputs=chatbot,
|
79 |
+
queue=True
|
80 |
+
).then(
|
81 |
+
fn=lambda: "", # Clear the input box after sending
|
82 |
+
inputs=None,
|
83 |
+
outputs=chat_input
|
84 |
+
)
|
85 |
+
|
86 |
+
with gr.TabItem("📖 Storyboard Generator"):
|
87 |
+
gr.Markdown("## Generate a Storyboard")
|
88 |
+
scenario_input = gr.Textbox(label="Enter your scenario")
|
89 |
+
generate_btn = gr.Button("Generate Storyboard")
|
90 |
+
storyboard_output = gr.Textbox(label="Generated Storyboard", interactive=False)
|
91 |
+
generate_btn.click(generate_storyboard, inputs=scenario_input, outputs=storyboard_output)
|
92 |
+
|
93 |
app.launch(share=True)
|
94 |
|
95 |
ui()
|