Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -8,11 +8,11 @@ from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStream
|
|
8 |
import gradio as gr
|
9 |
from threading import Thread
|
10 |
|
11 |
-
MODEL_LIST = ["
|
12 |
HF_TOKEN = os.environ.get("HF_TOKEN", None)
|
13 |
MODEL = os.environ.get("MODEL_ID")
|
14 |
|
15 |
-
TITLE = "<h1><center>
|
16 |
|
17 |
PLACEHOLDER = """
|
18 |
<center>
|
@@ -99,19 +99,8 @@ def stream_chat(
|
|
99 |
|
100 |
chatbot = gr.Chatbot(height=600, placeholder=PLACEHOLDER)
|
101 |
|
102 |
-
footer = """
|
103 |
-
<div style="text-align: center; margin-top: 20px;">
|
104 |
-
<a href="https://www.linkedin.com/in/pejman-ebrahimi-4a60151a7/" target="_blank">LinkedIn</a> |
|
105 |
-
<a href="https://github.com/arad1367" target="_blank">GitHub</a> |
|
106 |
-
<a href="https://arad1367.pythonanywhere.com/" target="_blank">Live demo of my PhD defense</a>
|
107 |
-
<br>
|
108 |
-
Made with 💖 by Pejman Ebrahimi
|
109 |
-
</div>
|
110 |
-
"""
|
111 |
-
|
112 |
with gr.Blocks(css=CSS, theme="small_and_pretty") as demo:
|
113 |
gr.HTML(TITLE)
|
114 |
-
gr.DuplicateButton(value="Duplicate Space for private use", elem_classes="duplicate-button")
|
115 |
gr.ChatInterface(
|
116 |
fn=stream_chat,
|
117 |
chatbot=chatbot,
|
@@ -119,7 +108,7 @@ with gr.Blocks(css=CSS, theme="small_and_pretty") as demo:
|
|
119 |
additional_inputs_accordion=gr.Accordion(label="⚙️ Parameters", open=False, render=False),
|
120 |
additional_inputs=[
|
121 |
gr.Textbox(
|
122 |
-
value="You are a
|
123 |
label="System Prompt",
|
124 |
render=False,
|
125 |
),
|
@@ -165,10 +154,9 @@ with gr.Blocks(css=CSS, theme="small_and_pretty") as demo:
|
|
165 |
),
|
166 |
],
|
167 |
examples=[
|
168 |
-
["
|
169 |
-
["
|
170 |
-
["
|
171 |
-
["Show me a code snippet of a website's sticky header in CSS and JavaScript."],
|
172 |
],
|
173 |
cache_examples=False,
|
174 |
)
|
|
|
8 |
import gradio as gr
|
9 |
from threading import Thread
|
10 |
|
11 |
+
MODEL_LIST = ["nawhgnuj/DonaldTrump-Llama3.1-8B-Chat"]
|
12 |
HF_TOKEN = os.environ.get("HF_TOKEN", None)
|
13 |
MODEL = os.environ.get("MODEL_ID")
|
14 |
|
15 |
+
TITLE = "<h1><center>nawhgnuj/DonaldTrump-Llama3.1-8B-Chat</center></h1>"
|
16 |
|
17 |
PLACEHOLDER = """
|
18 |
<center>
|
|
|
99 |
|
100 |
chatbot = gr.Chatbot(height=600, placeholder=PLACEHOLDER)
|
101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
with gr.Blocks(css=CSS, theme="small_and_pretty") as demo:
|
103 |
gr.HTML(TITLE)
|
|
|
104 |
gr.ChatInterface(
|
105 |
fn=stream_chat,
|
106 |
chatbot=chatbot,
|
|
|
108 |
additional_inputs_accordion=gr.Accordion(label="⚙️ Parameters", open=False, render=False),
|
109 |
additional_inputs=[
|
110 |
gr.Textbox(
|
111 |
+
value="You are a Donald Trump chatbot. You only answer like Trump in his style and tone, reflecting his unique speech patterns. Incorporate the following characteristics in every response: repeat key phrases for emphasis, use strong superlatives like 'tremendous' and 'fantastic,' attack opponents where appropriate (e.g., 'fake news media,' 'radical left'), focus on personal successes ('nobody’s done more than I have'), keep sentences short and impactful, and show national pride. Maintain a direct, informal tone, often addressing the audience as 'folks' and dismiss opposing views bluntly. Highlight patriotic themes like 'making America great again.'",
|
112 |
label="System Prompt",
|
113 |
render=False,
|
114 |
),
|
|
|
154 |
),
|
155 |
],
|
156 |
examples=[
|
157 |
+
["What do you think about kamala harris?"],
|
158 |
+
["What do you think about joe biden?"],
|
159 |
+
["What do you think about immigrants?"],
|
|
|
160 |
],
|
161 |
cache_examples=False,
|
162 |
)
|