girishwangikar commited on
Commit
cfae4d3
·
verified ·
1 Parent(s): fa2a5d2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -18
app.py CHANGED
@@ -153,21 +153,19 @@ def ui_function(text, question):
153
  example_text = """The Apollo 11 mission, launched by NASA in July 1969, was the first manned mission to land on the Moon. Commanded by Neil Armstrong and piloted by Buzz Aldrin and Michael Collins, it was the culmination of the Space Race between the United States and the Soviet Union. On July 20, 1969, Armstrong and Aldrin became the first humans to set foot on the lunar surface, while Collins orbited above in the command module."""
154
 
155
  # Create Gradio interface
156
- iface = gr.Interface(
157
- fn=ui_function,
158
- inputs=[
159
- gr.Textbox(label="Input Text", value=example_text),
160
- gr.Textbox(label="Question")
161
- ],
162
- outputs=[
163
- gr.Textbox(label="Answer"),
164
- gr.Image(label="Graph Visualization", type="filepath"),
165
- gr.Dataframe(label="Relations Table"),
166
- gr.Textbox(label="Summary"),
167
- gr.Image(label="Generated Image", type="filepath")
168
- ],
169
- title="GraphRAG and Image Generation UI",
170
- description="Enter text to create a graph, ask a question, and generate a relevant image."
171
- )
172
-
173
- iface.launch()
 
153
  example_text = """The Apollo 11 mission, launched by NASA in July 1969, was the first manned mission to land on the Moon. Commanded by Neil Armstrong and piloted by Buzz Aldrin and Michael Collins, it was the culmination of the Space Race between the United States and the Soviet Union. On July 20, 1969, Armstrong and Aldrin became the first humans to set foot on the lunar surface, while Collins orbited above in the command module."""
154
 
155
  # Create Gradio interface
156
+ with gr.Blocks() as iface:
157
+ with gr.Row():
158
+ with gr.Column():
159
+ input_text = gr.Textbox(label="Input Text", value=example_text)
160
+ question = gr.Textbox(label="Question")
161
+ example_box = gr.Markdown(f"### Example Paragraph\n\n{example_text}")
162
+ graph_viz = gr.Image(label="Graph Visualization", type="filepath")
163
+ with gr.Column():
164
+ answer = gr.Textbox(label="Answer")
165
+ relations_table = gr.Dataframe(label="Relations Table")
166
+ summary = gr.Textbox(label="Summary")
167
+ generated_image = gr.Image(label="Generated Image", type="filepath")
168
+
169
+ gr.Button("Run").click(ui_function, inputs=[input_text, question], outputs=[answer, graph_viz, relations_table, summary, generated_image])
170
+
171
+ iface.launch()