Spaces:
Build error
Build error
Update requirements.txt
Browse files- requirements.txt +25 -229
requirements.txt
CHANGED
@@ -2,12 +2,9 @@ import os
|
|
2 |
import google.generativeai as genai
|
3 |
import gradio as gr
|
4 |
|
|
|
|
|
5 |
|
6 |
-
|
7 |
-
genai.configure(api_key='AIzaSyDlTdKIg4UWVn6J_mRCEi6UIZZVb0jxxV4')
|
8 |
-
|
9 |
-
# Create the model
|
10 |
-
# See https://ai.google.dev/api/python/google/generativeai/GenerativeModel
|
11 |
generation_config = {
|
12 |
"temperature": 0.7,
|
13 |
"top_p": 0.95,
|
@@ -16,233 +13,32 @@ generation_config = {
|
|
16 |
"response_mime_type": "text/plain",
|
17 |
}
|
18 |
|
|
|
19 |
model = genai.GenerativeModel(
|
20 |
model_name="gemini-1.5-flash",
|
21 |
generation_config=generation_config,
|
22 |
-
# safety_settings = Adjust safety settings
|
23 |
-
# See https://ai.google.dev/gemini-api/docs/safety-settings
|
24 |
)
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
"response chillin, you?",
|
48 |
-
"prompt you up",
|
49 |
-
"response yeah",
|
50 |
-
"prompt i can come to you",
|
51 |
-
"response ok im at home",
|
52 |
-
"prompt sup",
|
53 |
-
"response shit all",
|
54 |
-
"prompt shit all",
|
55 |
-
"response sounds fun",
|
56 |
-
"prompt how much you need",
|
57 |
-
"response 40",
|
58 |
-
"prompt i've been sleeping for a couple\ndays",
|
59 |
-
"response what for?",
|
60 |
-
"prompt what you doing",
|
61 |
-
"response shopping",
|
62 |
-
"prompt do you know that kuro",
|
63 |
-
"response yeah i know him",
|
64 |
-
"prompt come downtown bro",
|
65 |
-
"response whats down there?",
|
66 |
-
"prompt give me a couple mins",
|
67 |
-
"response okay",
|
68 |
-
"prompt do you know anyone who knows how to unlock iphones",
|
69 |
-
"response yeah my bro crack",
|
70 |
-
"prompt fr",
|
71 |
-
"response yeah",
|
72 |
-
"prompt sup bro",
|
73 |
-
"response fuck all , listening to music",
|
74 |
-
"prompt can you use it if i take a cab to you",
|
75 |
-
"response okay",
|
76 |
-
"prompt can you pay my cab",
|
77 |
-
"response maybe how much will it be?",
|
78 |
-
"prompt ave r",
|
79 |
-
"response yeah, why you plotting?",
|
80 |
-
"prompt sup",
|
81 |
-
"response sippin",
|
82 |
-
"prompt do you have jib on you",
|
83 |
-
"response yeah",
|
84 |
-
"prompt can you pay my cab to you",
|
85 |
-
"response yeah",
|
86 |
-
"prompt but can i use ur bowl",
|
87 |
-
"response ya",
|
88 |
-
"prompt can you come help me",
|
89 |
-
"response with what?",
|
90 |
-
"prompt can you bring me one in a bit",
|
91 |
-
"response where to?",
|
92 |
-
"prompt can you bring a smoke to me",
|
93 |
-
"response sure",
|
94 |
-
"prompt can i ask you something",
|
95 |
-
"response what's that?",
|
96 |
-
"prompt do you have a hoot",
|
97 |
-
"response yeah",
|
98 |
-
"prompt idk lol y'all trippin me out can you do me a favor",
|
99 |
-
"response what kind?",
|
100 |
-
"prompt where is lynn",
|
101 |
-
"response idk",
|
102 |
-
"prompt can you walk me to the bus stop",
|
103 |
-
"response when?",
|
104 |
-
"prompt can you walk me to Avenue T",
|
105 |
-
"response okay",
|
106 |
-
"prompt can you get me a ride back to the hood bro",
|
107 |
-
"response where are you?",
|
108 |
-
"prompt do you have that chop",
|
109 |
-
"response no i lost it",
|
110 |
-
"prompt do you want to smoke a bowl",
|
111 |
-
"response of course lol",
|
112 |
-
"prompt can you ask those people about bag",
|
113 |
-
"response yeah i'll ask",
|
114 |
-
"prompt oops do you still have some of that bottle",
|
115 |
-
"response no i drank it",
|
116 |
-
"prompt well do you have dope or not",
|
117 |
-
"response yes i do",
|
118 |
-
"prompt can i pick it up",
|
119 |
-
"response when?",
|
120 |
-
"prompt where is it",
|
121 |
-
"response not sure\nidk",
|
122 |
-
"prompt can you try get a smoke",
|
123 |
-
"response i'll try",
|
124 |
-
"prompt can i ask you a question",
|
125 |
-
"response yeah",
|
126 |
-
"prompt can you give chris 2 smokes then at least",
|
127 |
-
"response ok",
|
128 |
-
"prompt where is lynn",
|
129 |
-
"response probably at home",
|
130 |
-
"prompt and can i have a hoot",
|
131 |
-
"response ok",
|
132 |
-
"prompt can you come get me please",
|
133 |
-
"response where are you?",
|
134 |
-
"prompt can you go check if she's there",
|
135 |
-
"response where?",
|
136 |
-
"prompt can you share one",
|
137 |
-
"response ya",
|
138 |
-
"prompt can you come here",
|
139 |
-
"response where?",
|
140 |
-
"prompt can i come by",
|
141 |
-
"response yeah",
|
142 |
-
"prompt where is here",
|
143 |
-
"response ave L",
|
144 |
-
"prompt do you have a battery pack that's charged",
|
145 |
-
"response no i dont",
|
146 |
-
"prompt do you have it",
|
147 |
-
"response no",
|
148 |
-
"prompt can i use ur e transfer",
|
149 |
-
"response ok but i dont have a card",
|
150 |
-
"prompt where is she",
|
151 |
-
"response sleeping",
|
152 |
-
"prompt okay where do you want to meet",
|
153 |
-
"response at the funeral home",
|
154 |
-
"prompt can you go pull it out",
|
155 |
-
"response i dont have a card",
|
156 |
-
"prompt what's up do you have a smoke",
|
157 |
-
"response i got a couple",
|
158 |
-
"prompt can you come back",
|
159 |
-
"response later i can",
|
160 |
-
"prompt can you come see me",
|
161 |
-
"response when?",
|
162 |
-
"prompt do you have a smoke",
|
163 |
-
"response yeah",
|
164 |
-
"prompt can you walk with me to the hospital in a bit",
|
165 |
-
"response ya",
|
166 |
-
"prompt can i use ur e transfer",
|
167 |
-
"response yeah",
|
168 |
-
"prompt do you want up",
|
169 |
-
"response i have some",
|
170 |
-
"prompt can you send that 20",
|
171 |
-
"response whats your email?",
|
172 |
-
"prompt can you get smokes",
|
173 |
-
"response ok",
|
174 |
-
"prompt do you have a pipe come see me ffs",
|
175 |
-
"response i have one, where are you?",
|
176 |
-
"prompt can you meet me there",
|
177 |
-
"response where?",
|
178 |
-
"prompt do you need it right now",
|
179 |
-
"response kind of",
|
180 |
-
"prompt do you bitches have bitches",
|
181 |
-
"response yeah",
|
182 |
-
"prompt can i borrow it for a bit",
|
183 |
-
"response for how long?",
|
184 |
-
"prompt how much do you need",
|
185 |
-
"response lots",
|
186 |
-
"prompt can you walk me home",
|
187 |
-
"response yeah",
|
188 |
-
"prompt can i see you",
|
189 |
-
"response when?",
|
190 |
-
"prompt where is he",
|
191 |
-
"response not sure",
|
192 |
-
"prompt do you have my dope",
|
193 |
-
"response no",
|
194 |
-
"prompt can i drop off my bag and can you keep it for me",
|
195 |
-
"response ok, for how long?",
|
196 |
-
"prompt thank you",
|
197 |
-
"response no problem",
|
198 |
-
"prompt hows your day?",
|
199 |
-
"response not bad, you?",
|
200 |
-
"prompt it's ok",
|
201 |
-
"response thats good",
|
202 |
-
"prompt you have bz?",
|
203 |
-
"response yeah",
|
204 |
-
"prompt can you smoke a bowl with me?",
|
205 |
-
"response yeah where are you?",
|
206 |
-
"prompt at kuros",
|
207 |
-
"response ok i'll come over soon",
|
208 |
-
"prompt i'm buzzed",
|
209 |
-
"response how much did you drink",
|
210 |
-
"prompt sup bro",
|
211 |
-
"response not much kinda tired",
|
212 |
-
"prompt are you gonna sleep?",
|
213 |
-
"response i might for a couple hours",
|
214 |
-
"prompt ok ill message you later",
|
215 |
-
"response ok peace",
|
216 |
-
"prompt what are you doing",
|
217 |
-
"response not much just bored",
|
218 |
-
"prompt i beat up shay",
|
219 |
-
"response holy what happened",
|
220 |
-
"prompt idk i was drunk",
|
221 |
-
"response lol",
|
222 |
-
"prompt got any chip ins?",
|
223 |
-
"response yeah for what?",
|
224 |
-
"prompt a 40oz",
|
225 |
-
"response i got 20 buck",
|
226 |
-
"prompt ok i have 20 to, come meet me?",
|
227 |
-
"response ok where at?",
|
228 |
-
"prompt do you have smokes?",
|
229 |
-
"response a few",
|
230 |
-
"prompt ok well get more later",
|
231 |
-
"response okay",
|
232 |
-
"prompt im doing good",
|
233 |
-
"response thats good",
|
234 |
-
"prompt want to go see lynn?",
|
235 |
-
"response not really",
|
236 |
-
"prompt who's all there",
|
237 |
-
"response just me",
|
238 |
-
"prompt aww cmon",
|
239 |
-
"response i'll come over later",
|
240 |
-
"prompt wanna come to confed?",
|
241 |
-
"response nah i'm good, i'm just chilling at home",
|
242 |
-
"prompt lets go downtown?",
|
243 |
-
"response okay what's up?",
|
244 |
-
"prompt ",
|
245 |
-
"response ",
|
246 |
-
])
|
247 |
|
248 |
-
|
|
|
2 |
import google.generativeai as genai
|
3 |
import gradio as gr
|
4 |
|
5 |
+
# Replace with your actual API key (ensure you are using the correct endpoint)
|
6 |
+
genai.configure(api_key=os.environ["GOOGLE_API_KEY"])
|
7 |
|
|
|
|
|
|
|
|
|
|
|
8 |
generation_config = {
|
9 |
"temperature": 0.7,
|
10 |
"top_p": 0.95,
|
|
|
13 |
"response_mime_type": "text/plain",
|
14 |
}
|
15 |
|
16 |
+
# Create the Gemini 1.5 Flash model
|
17 |
model = genai.GenerativeModel(
|
18 |
model_name="gemini-1.5-flash",
|
19 |
generation_config=generation_config,
|
|
|
|
|
20 |
)
|
21 |
|
22 |
+
# Define a function to generate responses
|
23 |
+
def generate_response(chatbot):
|
24 |
+
prompt = ""
|
25 |
+
for turn in chatbot:
|
26 |
+
prompt += f"{turn[0]}: {turn[1]}\n" # Format the conversation history
|
27 |
+
|
28 |
+
response = model.generate_text(
|
29 |
+
prompt=prompt,
|
30 |
+
temperature=0.7,
|
31 |
+
max_output_tokens=50,
|
32 |
+
)
|
33 |
+
|
34 |
+
return response.result
|
35 |
+
|
36 |
+
# Create Gradio interface
|
37 |
+
with gr.Blocks() as interface:
|
38 |
+
chatbot = gr.Chatbot()
|
39 |
+
msg = gr.Textbox()
|
40 |
+
clear = gr.ClearButton([msg, chatbot])
|
41 |
+
|
42 |
+
msg.submit(generate_response, [chatbot], chatbot)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
|
44 |
+
interface.launch()
|