sotirios-slv commited on
Commit
8f4f347
1 Parent(s): 9380cde

Updates to get it working again!

Browse files
Files changed (1) hide show
  1. app.py +64 -68
app.py CHANGED
@@ -3,15 +3,18 @@ import gradio as gr
3
 
4
  client = InferenceClient("mistralai/Mistral-7B-Instruct-v0.1")
5
 
6
- # <img src="/file=val_speaking_transparent.gif" style="width: 80%; max-width: 550px; height: auto; opacity: 0.55; ">
7
- PLACEHOLDER = """
 
8
  <div style="padding: 30px; text-align: center; display: flex; flex-direction: column; align-items: center;">
9
-
10
  <h1 style="font-size: 28px; margin-bottom: 2px; opacity: 0.55;">Hi Jennifer, welcome to DTF</h1>
11
  <p style="font-size: 18px; margin-bottom: 2px; opacity: 0.65;">Ask me anything about working at here...</p>
12
  </div>.
13
  """
14
 
 
 
15
 
16
  def format_prompt(message, history):
17
  prompt = "<s>"
@@ -61,69 +64,62 @@ def generate(
61
  return output
62
 
63
 
64
- # additional_inputs = [
65
- # gr.Slider(
66
- # label="Temperature",
67
- # value=0.9,
68
- # minimum=0.0,
69
- # maximum=1.0,
70
- # step=0.05,
71
- # interactive=True,
72
- # info="Higher values produce more diverse outputs",
73
- # ),
74
- # gr.Slider(
75
- # label="Max new tokens",
76
- # value=256,
77
- # minimum=0,
78
- # maximum=1048,
79
- # step=64,
80
- # interactive=True,
81
- # info="The maximum numbers of new tokens",
82
- # ),
83
- # gr.Slider(
84
- # label="Top-p (nucleus sampling)",
85
- # value=0.90,
86
- # minimum=0.0,
87
- # maximum=1,
88
- # step=0.05,
89
- # interactive=True,
90
- # info="Higher values sample more low-probability tokens",
91
- # ),
92
- # gr.Slider(
93
- # label="Repetition penalty",
94
- # value=1.2,
95
- # minimum=1.0,
96
- # maximum=2.0,
97
- # step=0.05,
98
- # interactive=True,
99
- # info="Penalize repeated tokens",
100
- # ),
101
- # ]
102
-
103
- with gr.Blocks(fill_height=True) as demo:
104
-
105
- gr.Image("/file=val_speaking_transparent.gif")
106
- gr.Markdown("Hi I'm Val the Voyager, welcome onboard!")
107
- gr.ChatInterface(
108
- fn=generate,
109
- chatbot=gr.Chatbot(
110
- show_label=False,
111
- show_share_button=False,
112
- show_copy_button=True,
113
- likeable=True,
114
- layout="panel",
115
- placeholder=PLACEHOLDER,
116
- ),
117
- # additional_inputs=additional_inputs,
118
- examples=[
119
- ["Ask me what an acronym stands for"],
120
- ["How can I check my leave allowance?"],
121
- ["Where can I find a floor map of 1 Macarthur?"],
122
- ["How can I find out about DTF's Disability network?"],
123
- ],
124
- cache_examples=False,
125
- title="""Voyager Val""",
126
- )
127
 
128
- if __name__ == "__main__":
129
- demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
 
4
  client = InferenceClient("mistralai/Mistral-7B-Instruct-v0.1")
5
 
6
+ val_image = gr.Image("/file=val_speaking_transparent.gif")
7
+
8
+ PLACEHOLDER = f"""
9
  <div style="padding: 30px; text-align: center; display: flex; flex-direction: column; align-items: center;">
10
+ <img src={val_image} style="width: 80%; max-width: 550px; height: auto; opacity: 0.55; ">
11
  <h1 style="font-size: 28px; margin-bottom: 2px; opacity: 0.55;">Hi Jennifer, welcome to DTF</h1>
12
  <p style="font-size: 18px; margin-bottom: 2px; opacity: 0.65;">Ask me anything about working at here...</p>
13
  </div>.
14
  """
15
 
16
+ TITLE = "Hi I'm Val the Voyager, welcome onboard!"
17
+
18
 
19
  def format_prompt(message, history):
20
  prompt = "<s>"
 
64
  return output
65
 
66
 
67
+ additional_inputs = [
68
+ gr.Slider(
69
+ label="Temperature",
70
+ value=0.9,
71
+ minimum=0.0,
72
+ maximum=1.0,
73
+ step=0.05,
74
+ interactive=True,
75
+ info="Higher values produce more diverse outputs",
76
+ ),
77
+ gr.Slider(
78
+ label="Max new tokens",
79
+ value=256,
80
+ minimum=0,
81
+ maximum=1048,
82
+ step=64,
83
+ interactive=True,
84
+ info="The maximum numbers of new tokens",
85
+ ),
86
+ gr.Slider(
87
+ label="Top-p (nucleus sampling)",
88
+ value=0.90,
89
+ minimum=0.0,
90
+ maximum=1,
91
+ step=0.05,
92
+ interactive=True,
93
+ info="Higher values sample more low-probability tokens",
94
+ ),
95
+ gr.Slider(
96
+ label="Repetition penalty",
97
+ value=1.2,
98
+ minimum=1.0,
99
+ maximum=2.0,
100
+ step=0.05,
101
+ interactive=True,
102
+ info="Penalize repeated tokens",
103
+ ),
104
+ ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
 
106
+ gr.ChatInterface(
107
+ fn=generate,
108
+ chatbot=gr.Chatbot(
109
+ show_label=False,
110
+ show_share_button=False,
111
+ show_copy_button=True,
112
+ likeable=True,
113
+ layout="panel",
114
+ placeholder=PLACEHOLDER,
115
+ ),
116
+ additional_inputs=additional_inputs,
117
+ examples=[
118
+ ["Ask me what an acronym stands for"],
119
+ ["How can I check my leave allowance?"],
120
+ ["Where can I find a floor map of 1 Macarthur?"],
121
+ ["How can I find out about DTF's Disability network?"],
122
+ ],
123
+ cache_examples=False,
124
+ title=TITLE,
125
+ ).launch(show_api=False)