Sethblocks commited on
Commit
23b91c1
1 Parent(s): 9cb1b8e

new file: app.py

Browse files

new file: requirements.txt

Files changed (2) hide show
  1. app.py +20 -0
  2. requirements.txt +0 -0
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from threading import Thread
3
+ import random
4
+ import llama_cpp
5
+ randtxt = ""
6
+ llama = llama_cpp.Llama("Phi-3-mini-4k-instruct-q4.gguf")
7
+
8
+ def randomize():
9
+ global randtxt
10
+ while(True):
11
+ randtxt = llama("I want to eat")["choices"][0]["text"]
12
+ Thread(target=randomize).start()
13
+
14
+ def watch(name):
15
+ while(True):
16
+ yield "I want to eat " + randtxt
17
+
18
+ demo = gr.Interface(watch,inputs=None, outputs=gr.Chatbot(), live=True)
19
+
20
+ demo.launch()
requirements.txt ADDED
File without changes