dlimeng commited on
Commit
d5bbdfb
1 Parent(s): 2393aad

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -34
app.py CHANGED
@@ -68,39 +68,17 @@ def gpt_inference(base_url, model, openai_key, prompt):
68
  return img
69
 
70
 
 
 
 
 
 
 
 
 
 
 
 
71
 
72
- css = """
73
- body {
74
- background-color: #F2F2F2;
75
- }
76
- """
77
-
78
- title = """
79
- <h2>SolidUI AI-generated visualization platform</h2>
80
- <p>AI-generated visualization prototyping and editing platform Support 2D, 3D models, combined with LLM(Large Language Model) for quick editing.</p>
81
- <a target="_blank" href="https://github.com/CloudOrc/SolidUI">
82
- <img src="https://img.shields.io/badge/-github-blue?logo=github" />
83
- </a>
84
- <a target="_blank" href="https://huggingface.co/spaces/CloudOrc/SolidUI">
85
- <img src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face%20Spaces-blue" />
86
- </a>
87
- """
88
-
89
- def layout_fn():
90
- with gr.Blocks(css=css) as demo:
91
- with gr.Column(elem_id="col-container"):
92
- gr.HTML(title)
93
- with gr.Form() as form:
94
- form.inputs = [
95
- gr.components.Textbox(default="", label="Base URL"),
96
- gr.components.Dropdown(choices=["gpt-3.5-turbo", "gpt-4"], default="gpt-3.5-turbo", label="Model"),
97
- gr.components.Textbox(default="", label="OpenAI Key"),
98
- gr.components.Textbox(default="", label="Prompt")
99
- ]
100
- form.outputs = [gr.Image(label="Output Image")]
101
- form.submit_button = gr.Button('Run')
102
- return demo
103
-
104
-
105
- iface = gr.Interface(fn=gpt_inference, inputs=[], outputs=[], layout=layout_fn)
106
  iface.launch()
 
68
  return img
69
 
70
 
71
+ iface = gr.Interface(
72
+ fn=gpt_inference,
73
+ inputs=[gr.components.Textbox(), gr.components.Dropdown(choices=["gpt-3.5-turbo", "gpt-4"], label="Model"),
74
+ gr.components.Textbox(), gr.components.Textbox()],
75
+ outputs=gr.Image(),
76
+ title="SolidUI AI-generated visualization platform",
77
+ description="""
78
+ AI-generated visualization prototyping and editing platform, support 2D, 3D models, combined with LLM(Large Language Model) for quick editing.
79
+ GitHub: https://github.com/CloudOrc/SolidUI
80
+ """,
81
+ labels=["Base URL", "Model", "OpenAI Key", "Prompt"]
82
 
83
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  iface.launch()