HFactor commited on
Commit
cbc25b3
1 Parent(s): d3d638d

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +41 -0
app.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio
2
+ import google.generativeai as palm
3
+
4
+
5
+
6
+ def gimi(user, history):
7
+
8
+ palm.configure(api_key = "AIzaSyCnyIq75tojLZKyNo6oyiebJlZx0IqGFI0")
9
+
10
+ defaults = {
11
+ 'model': 'models/text-bison-001',
12
+ 'temperature': 0.7,
13
+ 'candidate_count': 1,
14
+ 'top_k': 40,
15
+ 'top_p': 0.95,
16
+ 'max_output_tokens': 1024,
17
+ 'stop_sequences': [],
18
+ 'safety_settings': [
19
+ {"category": "HARM_CATEGORY_DEROGATORY", "threshold": 4},
20
+ {"category": "HARM_CATEGORY_TOXICITY", "threshold": 4},
21
+ {"category": "HARM_CATEGORY_VIOLENCE", "threshold": 4},
22
+ {"category": "HARM_CATEGORY_SEXUAL", "threshold": 4},
23
+ {"category": "HARM_CATEGORY_MEDICAL", "threshold": 4},
24
+ {"category": "HARM_CATEGORY_DANGEROUS", "threshold": 4},
25
+ ],
26
+
27
+
28
+ }
29
+ prompt = f"""{user}"""
30
+
31
+ response = palm.generate_text(
32
+ **defaults,
33
+ prompt=prompt
34
+ )
35
+ gen_response=(response.result)
36
+ return gen_response
37
+
38
+
39
+ demo = gradio.ChatInterface(gimi)
40
+
41
+ demo.launch(share=True)