Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -772,68 +772,73 @@ title_html = """
|
|
| 772 |
</p>
|
| 773 |
"""
|
| 774 |
|
| 775 |
-
|
| 776 |
-
|
| 777 |
-
lines=3,
|
| 778 |
-
value="You are a deep thinking AI. Please respond in the same language as the input prompt. If the input is in English, answer in English. If it is in another language (e.g., Korean, Japanese), answer in that language using your full reasoning capabilities.",
|
| 779 |
-
visible=False # 화면에서 감춤
|
| 780 |
-
)
|
| 781 |
-
|
| 782 |
-
max_tokens_slider = gr.Slider(
|
| 783 |
-
label="Max New Tokens",
|
| 784 |
-
minimum=100,
|
| 785 |
-
maximum=8000,
|
| 786 |
-
step=50,
|
| 787 |
-
value=1000,
|
| 788 |
-
visible=False # 화면에서 감춤
|
| 789 |
-
)
|
| 790 |
-
|
| 791 |
-
web_search_checkbox = gr.Checkbox(
|
| 792 |
-
label="Deep Research",
|
| 793 |
-
value=False
|
| 794 |
-
)
|
| 795 |
|
| 796 |
-
|
| 797 |
-
|
| 798 |
-
|
| 799 |
-
|
| 800 |
-
|
| 801 |
-
)
|
| 802 |
|
| 803 |
-
#
|
| 804 |
-
|
| 805 |
-
|
| 806 |
-
|
| 807 |
-
|
| 808 |
-
|
| 809 |
-
|
| 810 |
-
|
| 811 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 812 |
],
|
| 813 |
-
|
| 814 |
-
|
| 815 |
-
|
| 816 |
-
|
| 817 |
-
|
| 818 |
-
|
| 819 |
-
|
| 820 |
-
|
| 821 |
-
|
| 822 |
-
|
| 823 |
-
|
| 824 |
-
|
| 825 |
-
|
| 826 |
-
run_examples_on_click=False,
|
| 827 |
-
cache_examples=False,
|
| 828 |
-
css_paths=None,
|
| 829 |
-
delete_cache=(1800, 1800),
|
| 830 |
-
)
|
| 831 |
|
| 832 |
-
# 예제 섹션 - 이미 ChatInterface에 examples가 설정되어 있으므로 여기서는 설명만 표시
|
| 833 |
-
with gr.Row(elem_id="examples_row"):
|
| 834 |
-
with gr.Column(scale=12, elem_id="examples_container"):
|
| 835 |
-
gr.Markdown("### Example Inputs (click to load)")
|
| 836 |
|
| 837 |
if __name__ == "__main__":
|
| 838 |
# Run locally
|
| 839 |
-
|
|
|
|
| 772 |
</p>
|
| 773 |
"""
|
| 774 |
|
| 775 |
+
with gr.Blocks(css=css, title="Gemma3-R1984-27B") as demo:
|
| 776 |
+
gr.Markdown(title_html)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 777 |
|
| 778 |
+
# Display the web search option (while the system prompt and token slider remain hidden)
|
| 779 |
+
web_search_checkbox = gr.Checkbox(
|
| 780 |
+
label="Deep Research",
|
| 781 |
+
value=False
|
| 782 |
+
)
|
|
|
|
| 783 |
|
| 784 |
+
# Used internally but not visible to the user
|
| 785 |
+
system_prompt_box = gr.Textbox(
|
| 786 |
+
lines=3,
|
| 787 |
+
value="Please answer in English. You are a deep thinking AI that may use extremely long chains of thought to thoroughly analyze the problem and deliberate using systematic reasoning processes to arrive at a correct solution before answering. You have the ability to read sources in other languages, but you must always answer in English. Even if the search results are in another language, answer in English.",
|
| 788 |
+
visible=False # hidden from view
|
| 789 |
+
)
|
| 790 |
+
|
| 791 |
+
max_tokens_slider = gr.Slider(
|
| 792 |
+
label="Max New Tokens",
|
| 793 |
+
minimum=100,
|
| 794 |
+
maximum=8000,
|
| 795 |
+
step=50,
|
| 796 |
+
value=1000,
|
| 797 |
+
visible=False # hidden from view
|
| 798 |
+
)
|
| 799 |
+
|
| 800 |
+
web_search_text = gr.Textbox(
|
| 801 |
+
lines=1,
|
| 802 |
+
label="(Unused) Web Search Query",
|
| 803 |
+
placeholder="No direct input needed",
|
| 804 |
+
visible=False # hidden from view
|
| 805 |
+
)
|
| 806 |
+
|
| 807 |
+
# Configure the chat interface
|
| 808 |
+
chat = gr.ChatInterface(
|
| 809 |
+
fn=run,
|
| 810 |
+
type="messages",
|
| 811 |
+
chatbot=gr.Chatbot(type="messages", scale=1, allow_tags=["image"]),
|
| 812 |
+
textbox=gr.MultimodalTextbox(
|
| 813 |
+
file_types=[
|
| 814 |
+
".webp", ".png", ".jpg", ".jpeg", ".gif",
|
| 815 |
+
".mp4", ".csv", ".txt", ".pdf"
|
| 816 |
+
],
|
| 817 |
+
file_count="multiple",
|
| 818 |
+
autofocus=True
|
| 819 |
+
),
|
| 820 |
+
multimodal=True,
|
| 821 |
+
additional_inputs=[
|
| 822 |
+
system_prompt_box,
|
| 823 |
+
max_tokens_slider,
|
| 824 |
+
web_search_checkbox,
|
| 825 |
+
web_search_text,
|
| 826 |
],
|
| 827 |
+
stop_btn=False,
|
| 828 |
+
title='<a href="https://discord.gg/openfreeai" target="_blank">https://discord.gg/openfreeai</a>',
|
| 829 |
+
examples=examples,
|
| 830 |
+
run_examples_on_click=False,
|
| 831 |
+
cache_examples=False,
|
| 832 |
+
css_paths=None,
|
| 833 |
+
delete_cache=(1800, 1800),
|
| 834 |
+
)
|
| 835 |
+
|
| 836 |
+
# Example section - since examples are already set in ChatInterface, this is for display only
|
| 837 |
+
with gr.Row(elem_id="examples_row"):
|
| 838 |
+
with gr.Column(scale=12, elem_id="examples_container"):
|
| 839 |
+
gr.Markdown("### Example Inputs (click to load)")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 840 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 841 |
|
| 842 |
if __name__ == "__main__":
|
| 843 |
# Run locally
|
| 844 |
+
demo.launch()
|