Spaces:
Paused
Paused
Hoang Thanh Tung
commited on
Commit
·
a4c28a5
1
Parent(s):
4f541b2
Add raw output
Browse files- app.py +4 -2
- requirements.txt +1 -0
app.py
CHANGED
|
@@ -146,7 +146,9 @@ def generate(features, image, garment_type, structure, reference, model, tempera
|
|
| 146 |
chat_response = chat.invoke(messages, temperature=temperature)
|
| 147 |
print(messages[0].content)
|
| 148 |
alt_texts_str = '\n\n### Alt text\n\n' + '\n- ' + '\n- '.join(alt_texts) if len(alt_texts) > 0 else ""
|
| 149 |
-
|
|
|
|
|
|
|
| 150 |
|
| 151 |
|
| 152 |
demo = gr.Interface(
|
|
@@ -158,7 +160,7 @@ demo = gr.Interface(
|
|
| 158 |
gr.Textbox(reference, label="Reference copy"),
|
| 159 |
gr.Dropdown(["gpt-4-turbo", "gpt-3.5-turbo", "claude-3-sonnet-20240229", "claude-3-opus-20240229", "llama3-70b-8192"], value="llama3-70b-8192", label="Model"),
|
| 160 |
gr.Slider(minimum=0., maximum=1.0, value=0.5, label="Temperature")],
|
| 161 |
-
outputs=["
|
| 162 |
)
|
| 163 |
|
| 164 |
# demo.launch()
|
|
|
|
| 146 |
chat_response = chat.invoke(messages, temperature=temperature)
|
| 147 |
print(messages[0].content)
|
| 148 |
alt_texts_str = '\n\n### Alt text\n\n' + '\n- ' + '\n- '.join(alt_texts) if len(alt_texts) > 0 else ""
|
| 149 |
+
result_text = chat_response.content
|
| 150 |
+
result_md = chat_response.content + alt_texts_str + '\n'.join([f'' if base64_image != "" else "" for (base64_image, alt_text) in zip(base64_images, alt_texts)])
|
| 151 |
+
return result_md, result_text
|
| 152 |
|
| 153 |
|
| 154 |
demo = gr.Interface(
|
|
|
|
| 160 |
gr.Textbox(reference, label="Reference copy"),
|
| 161 |
gr.Dropdown(["gpt-4-turbo", "gpt-3.5-turbo", "claude-3-sonnet-20240229", "claude-3-opus-20240229", "llama3-70b-8192"], value="llama3-70b-8192", label="Model"),
|
| 162 |
gr.Slider(minimum=0., maximum=1.0, value=0.5, label="Temperature")],
|
| 163 |
+
outputs=[gr.Markdown(label="Markdown"), gr.Textbox(label="Raw text")],
|
| 164 |
)
|
| 165 |
|
| 166 |
# demo.launch()
|
requirements.txt
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
langchain
|
| 2 |
langchain_openai
|
| 3 |
langchain_anthropic
|
|
|
|
| 1 |
+
gradio
|
| 2 |
langchain
|
| 3 |
langchain_openai
|
| 4 |
langchain_anthropic
|