Spaces:
Sleeping
Sleeping
Update app.py
Browse files18 unmodified lines192021222223242526272824252627282930303132323334353637388 unmodified lines47484948505150525354551 unmodified line57585958606162639 unmodified lines7374757618 unmodified lines if val[1]: messages.append({"role": "assistant", "content": val[1]})
# Formatting the user input to focus on reasoning # Provide the reasoning without revealing the final sequence formatted_prompt = f""" You are a chatbot that provides a structured sequence reasoning without long explanations or revealing the final sequence. Provide reasoning by structuring the clues like: Animal: orange tiger (commonly orange) Color: orange Fruit: orange (shares the same color) You are a chatbot that helps users think through a sequence of words. Provide reasoning for each part of the sequence: 1. For the first word, describe an animal. 2. For the second word, give a clue for a fruit. 3. For the third word, describe the color itself.
Do NOT give away the final sequence directly. Instead, help the user think through the sequence. DO NOT give away the final sequence. Instead, offer clues that will guide the user to think creatively and connect the words themselves.
Now, explain the reasoning behind: "{message}" Now, help me think through this sequence: "{message}" """
messages.append({"role": "user", "content": formatted_prompt})
response = ""8 unmodified lines token = message.choices[0].delta.content response += token
# Ensuring the output is structured and concise without revealing the answer # Ensure the response is just reasoning and hints, not the answer if len(response.split()) > 50: # Prevent long explanations response = "Animal: orange tiger (commonly orange)\nColor: orange\nFruit: orange (shares the same color)\nSequence: orange tiger (Animal) -> orange (Color) -> orange (Fruit)" response = "Let's break it down:\n1. Think of an animal often linked to the color orange.\n2. Now, consider a fruit of the same color.\n3. Finally, what's the color that connects both?"
yield response
1 unmodified linedemo = gr.ChatInterface( respond, additional_inputs=[ gr.Textbox(value="You are a chatbot that helps users think through a sequence of words. Provide a structured and concise reasoning without revealing the final sequence.", label="System message"), gr.Textbox(value="You are a chatbot that helps users think through a sequence of words. Provide structured clues and avoid giving the final sequence directly.", label="System message"), gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"), gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"), gr.Slider(9 unmodified linesif __name__ == "__main__": demo.launch()
app.py+14-11