Simeon Schüz commited on
Commit
388bcbd
·
1 Parent(s): 2507bd0
Files changed (2) hide show
  1. app.py +5 -3
  2. test.py +13 -0
app.py CHANGED
@@ -12,7 +12,7 @@ model = AutoModelForCausalLM.from_pretrained(
12
  )
13
 
14
 
15
- def predict(prompt):
16
 
17
  # prepare the model input
18
  messages = [
@@ -45,8 +45,10 @@ def predict(prompt):
45
 
46
  # print("thinking content:", thinking_content)
47
  # print("content:", content)
48
-
49
- return thinking_content, content
 
 
50
 
51
 
52
  demo = gr.Interface(fn=predict, inputs="text", outputs="text")
 
12
  )
13
 
14
 
15
+ def predict(prompt, return_thinking_content=False):
16
 
17
  # prepare the model input
18
  messages = [
 
45
 
46
  # print("thinking content:", thinking_content)
47
  # print("content:", content)
48
+ if return_thinking_content:
49
+ return thinking_content, content
50
+ else:
51
+ return content
52
 
53
 
54
  demo = gr.Interface(fn=predict, inputs="text", outputs="text")
test.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from gradio_client import Client
2
+
3
+ client = Client("simeonjunker/modeltest")
4
+ print(client)
5
+
6
+ prompt = 'Give me a short introduction to large language models.'
7
+
8
+ result = client.predict(
9
+ prompt=prompt,
10
+ api_name="/predict"
11
+ )
12
+
13
+ print(result)