ProPerNounpYK commited on
Commit
49d2812
·
verified ·
1 Parent(s): 63c1714

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import gradio as gr
2
  from huggingface_hub import InferenceClient
3
 
@@ -6,6 +7,15 @@ For more information on `huggingface_hub` Inference API support, please check th
6
  """
7
  client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
8
 
 
 
 
 
 
 
 
 
 
9
 
10
  def respond(
11
  message,
@@ -60,4 +70,8 @@ demo = gr.ChatInterface(
60
 
61
 
62
  if __name__ == "__main__":
 
 
 
 
63
  demo.launch()
 
1
+ import csv
2
  import gradio as gr
3
  from huggingface_hub import InferenceClient
4
 
 
7
  """
8
  client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
9
 
10
+ def load_prompts(file_path):
11
+ prompts = []
12
+ with open(file_path, 'r') as file:
13
+ reader = csv.DictReader(file)
14
+ for row in reader:
15
+ prompts.append(row)
16
+ return prompts
17
+
18
+ prompts = load_prompts('app.py/prompts.csv')
19
 
20
  def respond(
21
  message,
 
70
 
71
 
72
  if __name__ == "__main__":
73
+ # When the script is run as a standalone application, load the prompts from the prompts.csv file
74
+ if __name__ == "__main__":
75
+ prompts = load_prompts('app.py/prompts.csv')
76
+
77
  demo.launch()