Spaces:
Runtime error
Runtime error
thepolymerguy
commited on
Commit
•
94f6c5d
1
Parent(s):
4649b38
Upload app.py
Browse files
app.py
CHANGED
@@ -37,6 +37,21 @@ model = LlamaForCausalLM.from_pretrained(
|
|
37 |
device_map='auto',
|
38 |
)
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
########## DEFINING FUNCTIONS ###################
|
41 |
|
42 |
def mean_pooling(model_output, attention_mask):
|
@@ -189,6 +204,8 @@ def classifier(userin, SearchType):
|
|
189 |
|
190 |
md_class = '\n'.join(class_links)
|
191 |
|
|
|
|
|
192 |
return md_class
|
193 |
|
194 |
def generateresponse(history, temp, top_p, tokens):
|
@@ -219,10 +236,7 @@ def generateresponse(history, temp, top_p, tokens):
|
|
219 |
|
220 |
response = f"Response{outputs}"
|
221 |
|
222 |
-
|
223 |
-
count = 1
|
224 |
-
f.write(f'{count}\n')
|
225 |
-
f.close()
|
226 |
|
227 |
return response
|
228 |
|
@@ -254,10 +268,7 @@ def run_model(userin, dropd, temp, top_p, tokens):
|
|
254 |
|
255 |
response = f"Response{outputs}"
|
256 |
|
257 |
-
|
258 |
-
count = 1
|
259 |
-
f.write(f'{count}\n')
|
260 |
-
f.close()
|
261 |
|
262 |
return response
|
263 |
|
@@ -293,10 +304,7 @@ def prosecute(application, priorart, temp, top_p, tokens):
|
|
293 |
|
294 |
response = f"Response{outputs}"
|
295 |
|
296 |
-
|
297 |
-
count = 1
|
298 |
-
f.write(f'{count}\n')
|
299 |
-
f.close()
|
300 |
|
301 |
return response
|
302 |
|
@@ -329,10 +337,7 @@ def ideator(userin, temp, top_p, tokens):
|
|
329 |
|
330 |
response = f"Response{outputs}"
|
331 |
|
332 |
-
|
333 |
-
count = 1
|
334 |
-
f.write(f'{count}\n')
|
335 |
-
f.close()
|
336 |
|
337 |
return response
|
338 |
|
@@ -364,10 +369,7 @@ def Chat(userin, temp, top_p, tokens):
|
|
364 |
|
365 |
response = f"Response{outputs}"
|
366 |
|
367 |
-
|
368 |
-
count = 1
|
369 |
-
f.write(f'{count}\n')
|
370 |
-
f.close()
|
371 |
|
372 |
return response
|
373 |
|
@@ -563,3 +565,4 @@ with gr.Blocks(title='Claimed', theme=theme) as demo:
|
|
563 |
""")
|
564 |
demo.queue(max_size=15)
|
565 |
demo.launch()
|
|
|
|
37 |
device_map='auto',
|
38 |
)
|
39 |
|
40 |
+
|
41 |
+
DATASET_REPO_URL = "https://huggingface.co/datasets/Claimed/logger"
|
42 |
+
DATA_FILENAME = "data.csv"
|
43 |
+
DATA_FILE = os.path.join("data", DATA_FILENAME)
|
44 |
+
|
45 |
+
def store_log():
|
46 |
+
with open(DATA_FILE, "a") as csvfile:
|
47 |
+
writer = csv.DictWriter(csvfile, fieldnames=["count", "time"])
|
48 |
+
writer.writerow(
|
49 |
+
{"count": 1, "time": str(datetime.now())}
|
50 |
+
)
|
51 |
+
commit_url = repo.push_to_hub()
|
52 |
+
print(commit_url)
|
53 |
+
return
|
54 |
+
|
55 |
########## DEFINING FUNCTIONS ###################
|
56 |
|
57 |
def mean_pooling(model_output, attention_mask):
|
|
|
204 |
|
205 |
md_class = '\n'.join(class_links)
|
206 |
|
207 |
+
store_log()
|
208 |
+
|
209 |
return md_class
|
210 |
|
211 |
def generateresponse(history, temp, top_p, tokens):
|
|
|
236 |
|
237 |
response = f"Response{outputs}"
|
238 |
|
239 |
+
store_log()
|
|
|
|
|
|
|
240 |
|
241 |
return response
|
242 |
|
|
|
268 |
|
269 |
response = f"Response{outputs}"
|
270 |
|
271 |
+
store_log()
|
|
|
|
|
|
|
272 |
|
273 |
return response
|
274 |
|
|
|
304 |
|
305 |
response = f"Response{outputs}"
|
306 |
|
307 |
+
store_log()
|
|
|
|
|
|
|
308 |
|
309 |
return response
|
310 |
|
|
|
337 |
|
338 |
response = f"Response{outputs}"
|
339 |
|
340 |
+
store_log()
|
|
|
|
|
|
|
341 |
|
342 |
return response
|
343 |
|
|
|
369 |
|
370 |
response = f"Response{outputs}"
|
371 |
|
372 |
+
store_log()
|
|
|
|
|
|
|
373 |
|
374 |
return response
|
375 |
|
|
|
565 |
""")
|
566 |
demo.queue(max_size=15)
|
567 |
demo.launch()
|
568 |
+
|