Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -53,10 +53,11 @@ def respond(message, history, system_message, max_tokens, temperature, top_p):
|
|
| 53 |
If multiple such sections exist, their contents are concatenated.
|
| 54 |
"""
|
| 55 |
# Compile the pattern with the desired flags
|
| 56 |
-
pattern = re.compile(r'
|
| 57 |
matches = re.findall(pattern, text)
|
| 58 |
extracted_content = '\n'.join(match.strip() for match in matches)
|
| 59 |
return extracted_content
|
|
|
|
| 60 |
lines = extract_user_content(generated_text)
|
| 61 |
|
| 62 |
return lines
|
|
@@ -67,7 +68,7 @@ def respond(message, history, system_message, max_tokens, temperature, top_p):
|
|
| 67 |
demo = gr.ChatInterface(
|
| 68 |
respond,
|
| 69 |
additional_inputs=[
|
| 70 |
-
gr.Textbox(value="Take the user input in Hindi language and normalize specific entities, Only including: Dates (any format) Currencies Scientific units, <Example> Exampleinput : 2012–13 में रक्षा सेवाओं के लिए 1,93,407 करोड़ रुपए का प्रावधान किया गया था, जबकि 2011–2012 में यह राशि 1,64,415 करोइ़ थी, Exampleoutput: ट्वेन्टी ट्वेल्व फिफ्टीन में रक्षा सेवाओं के लिए वन करोड़ निनेटी थ्री थाउजेंड फोर हंड्रेड सेवन करोड़ रुपए का प्रावधान किया गया था, जबकि ट्वेन्टी एलेवन ट्वेल्व में यह राशि वन करोड़ सिक्स्टी फोर थाउजेंड फोर हंड्रेड फिफ्टीन करोड़ थी </Example>, Only provide the normalized output with atmost accuracy",label="System message"),
|
| 71 |
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
| 72 |
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
| 73 |
gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)")
|
|
|
|
| 53 |
If multiple such sections exist, their contents are concatenated.
|
| 54 |
"""
|
| 55 |
# Compile the pattern with the desired flags
|
| 56 |
+
pattern = re.compile(r'<user>(.*?)</user>', re.IGNORECASE | re.DOTALL)
|
| 57 |
matches = re.findall(pattern, text)
|
| 58 |
extracted_content = '\n'.join(match.strip() for match in matches)
|
| 59 |
return extracted_content
|
| 60 |
+
|
| 61 |
lines = extract_user_content(generated_text)
|
| 62 |
|
| 63 |
return lines
|
|
|
|
| 68 |
demo = gr.ChatInterface(
|
| 69 |
respond,
|
| 70 |
additional_inputs=[
|
| 71 |
+
gr.Textbox(value="Take the user input in Hindi language and normalize specific entities, Only including: Dates (any format) Currencies Scientific units, <Example> Exampleinput : 2012–13 में रक्षा सेवाओं के लिए 1,93,407 करोड़ रुपए का प्रावधान किया गया था, जबकि 2011–2012 में यह राशि 1,64,415 करोइ़ थी, Exampleoutput: ट्वेन्टी ट्वेल्व फिफ्टीन में रक्षा सेवाओं के लिए वन करोड़ निनेटी थ्री थाउजेंड फोर हंड्रेड सेवन करोड़ रुपए का प्रावधान किया गया था, जबकि ट्वेन्टी एलेवन ट्वेल्व में यह राशि वन करोड़ सिक्स्टी फोर थाउजेंड फोर हंड्रेड फिफ्टीन करोड़ थी </Example>, Only provide the normalized output with atmost accuracy inside <user> xml tag",label="System message"),
|
| 72 |
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
| 73 |
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
| 74 |
gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-p (nucleus sampling)")
|