Update app.py
Browse files
app.py
CHANGED
@@ -67,16 +67,40 @@ def gpt_inference(base_url, model, openai_key, prompt):
|
|
67 |
img = decode_image(img_b64)
|
68 |
return img
|
69 |
|
70 |
-
iface = gr.Interface(
|
71 |
-
fn=gpt_inference,
|
72 |
-
inputs=[gr.components.Textbox(), gr.components.Dropdown(choices=["gpt-3.5-turbo", "gpt-4"], label="Model"), gr.components.Textbox(), gr.components.Textbox()],
|
73 |
-
outputs=gr.Image(),
|
74 |
-
title="SolidUI AI-generated visualization platform",
|
75 |
-
description="""
|
76 |
-
AI-generated visualization prototyping and editing platform, support 2D, 3D models, combined with LLM(Large Language Model) for quick editing.
|
77 |
-
GitHub: https://github.com/CloudOrc/SolidUI
|
78 |
-
""",
|
79 |
-
labels=["Base URL", "Model", "OpenAI Key","Prompt"]
|
80 |
|
81 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
iface.launch()
|
|
|
67 |
img = decode_image(img_b64)
|
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, layout=layout_fn)
|
106 |
iface.launch()
|