kwabs22 commited on
Commit
35ed179
·
1 Parent(s): 43b1821

More buttons

Browse files
Files changed (1) hide show
  1. app.py +4 -63
app.py CHANGED
@@ -64,67 +64,6 @@ def generate_response(user_message): #generate_response_token_by_token
64
  if process.returncode != 0:
65
  error_message = process.stderr.read()
66
  print(f"Error: {error_message}")
67
-
68
- # def custom_generate_response0(cust_user_message):
69
- # cust_user_message = CustomPrompts[0] + '\n\n' + cust_user_message + '\n\nClass Diagram:'
70
- # yield from generate_response(cust_user_message)
71
-
72
- # def custom_generate_response1(cust_user_message):
73
- # cust_user_message = CustomPrompts[1] + '\n\n' + cust_user_message + '\n\nPydot Code:'
74
- # yield from generate_response(cust_user_message)
75
-
76
- # def custom_generate_response2(cust_user_message):
77
- # cust_user_message = CustomPrompts[2] + '\n' + cust_user_message + '\n\nScene Details'
78
- # yield from generate_response(cust_user_message)
79
-
80
- # def custom_generate_response3(cust_user_message):
81
- # cust_user_message = CustomPrompts[3] + '\n' + cust_user_message + '\n\nTeardown Details:'
82
- # yield from generate_response(cust_user_message)
83
-
84
- # def custom_generate_response4(cust_user_message):
85
- # cust_user_message = CustomPrompts[4] + '\n' + cust_user_message + '\n\nManufacturing Details:'
86
- # yield from generate_response(cust_user_message)
87
-
88
- # def custom_generate_response5(cust_user_message):
89
- # cust_user_message = CustomPrompts[5] + '\n' + cust_user_message + '\n\nConsiderations:'
90
- # yield from generate_response(cust_user_message)
91
-
92
- # CustomPrompts = [
93
- # "Write a Class Diagram based on the following text:",
94
- # "Write a Pydot code based on the following text:",
95
- # "Describe what a standard happy scene in any movie would be planned in great detail, based on the following text:",
96
- # "Explain a teardown of the product mentioned in the following text:",
97
- # "Explain the manufacturing of the product mentioned in the following text:",
98
- # "Explain the marketing considerations of the product mentioned in the following text:",
99
- # ]
100
-
101
- # with gr.Blocks() as iface:
102
- # gr.Interface(
103
- # fn=generate_response,
104
- # inputs=gr.Textbox(lines=2, placeholder="Type your message here..."),
105
- # outputs="text",
106
- # title="Stable LM 2 Zephyr (1.6b) LLama.cpp Interface Test (Inconsistent Performance - 100 tokens in 50 secs or 800+ secs | Over 100 token prompt always slow)",
107
- # description="No Prompt template used yet (Essentially autocomplete). No Message History for now - Enter your message and get a response.",
108
- # flagging_dir="/usr/src/app/flagged",
109
- # )
110
- # #gr.Interface(fn=generate_response_token_by_token, inputs=gr.Textbox(lines=2, placeholder='Type prompt here...'), outputs="text", description="More Responsive streaming test")
111
- # with gr.Group():
112
- # gr.HTML("Test for wrapping generator (Instead of buttons tabs and dropdowns?)")
113
- # MainOutput = gr.TextArea(placeholder='Output will show here')
114
- # CustomButtonInput = gr.TextArea(lines=1, placeholder='Prompt goes here')
115
- # CustomButtonTeardown = gr.Button(CustomPrompts[3])
116
- # CustomButtonManufacture = gr.Button(CustomPrompts[4])
117
- # CustomButtonMarketingConsid = gr.Button(CustomPrompts[5])
118
- # CustomButtonClassDiagram = gr.Button(CustomPrompts[0])
119
- # CustomButtonPydotcode = gr.Button(CustomPrompts[1])
120
- # CustomButtonHappyMovieScene = gr.Button(CustomPrompts[2])
121
- # CustomButtonClassDiagram.click(custom_generate_response0, inputs=[CustomButtonInput], outputs=MainOutput)
122
- # CustomButtonPydotcode.click(custom_generate_response1, inputs=[CustomButtonInput], outputs=MainOutput)
123
- # CustomButtonHappyMovieScene.click(custom_generate_response2, inputs=[CustomButtonInput], outputs=MainOutput)
124
- # CustomButtonTeardown.click(custom_generate_response3, inputs=[CustomButtonInput], outputs=MainOutput)
125
- # CustomButtonManufacture.click(custom_generate_response4, inputs=[CustomButtonInput], outputs=MainOutput)
126
- # CustomButtonMarketingConsid.click(custom_generate_response5, inputs=[CustomButtonInput], outputs=MainOutput)
127
-
128
 
129
  def custom_generate_response(cust_user_message, prompt_index):
130
  """
@@ -147,14 +86,16 @@ CustomPrompts = [
147
  ("Explain the manufacturing of the product mentioned in the following text:", "Manufacturing Details:"),
148
  ("Explain the marketing considerations of the product mentioned in the following text:", "Considerations:"),
149
  ("Explain the target users considerations of the product mentioned in the following text:", "Target Users Considerations:"),
 
150
  ]
151
 
152
- with gr.Blocks() as iface:
 
153
  gr.Interface(
154
  fn=generate_response,
155
  inputs=gr.Textbox(lines=2, placeholder="Type your message here..."),
156
  outputs="text",
157
- title="Stable LM 2 Zephyr (1.6b) LLama.cpp Interface Test (Inconsistent Performance - 100 tokens in 50 secs or 800+ secs)",
158
  description="No Prompt template used yet (Essentially autocomplete). No Message History for now - Enter your message and get a response.",
159
  flagging_dir="/usr/src/app/flagged",
160
  )
 
64
  if process.returncode != 0:
65
  error_message = process.stderr.read()
66
  print(f"Error: {error_message}")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
 
68
  def custom_generate_response(cust_user_message, prompt_index):
69
  """
 
86
  ("Explain the manufacturing of the product mentioned in the following text:", "Manufacturing Details:"),
87
  ("Explain the marketing considerations of the product mentioned in the following text:", "Considerations:"),
88
  ("Explain the target users considerations of the product mentioned in the following text:", "Target Users Considerations:"),
89
+ ("My problem to solve is", "- please make 10 sub problems have to solve from this:"),
90
  ]
91
 
92
+ with gr.Blocks() as iface:
93
+ gr.HTML("Stabilityai's demo - https://huggingface.co/spaces/stabilityai/stablelm-2-1_6b-zephyr")
94
  gr.Interface(
95
  fn=generate_response,
96
  inputs=gr.Textbox(lines=2, placeholder="Type your message here..."),
97
  outputs="text",
98
+ title="Stable LM 2 Zephyr (1.6b) LLama.cpp Interface Test (Inconsistent Performance - 100 tokens in 50 secs (when this HF space is updated) or 800+ secs(HF space open for long))",
99
  description="No Prompt template used yet (Essentially autocomplete). No Message History for now - Enter your message and get a response.",
100
  flagging_dir="/usr/src/app/flagged",
101
  )