Spaces:
Sleeping
Sleeping
Update app.py
Browse files18 unmodified lines192021222223242526272829252631272829303132333411 unmodified lines4647484949505152535455515253541 unmodified line56575863596061628 unmodified lines717273787918 unmodified lines if val[1]: messages.append({"role": "assistant", "content": val[1]})
# Guide the user through the reasoning process, without revealing the final sequence # Modify the prompt to make the clues specific to each sequence (no generic format) formatted_prompt = f""" You are a chatbot that helps users think through the connections between an animal, a fruit, and a color. Provide reasoning for each part of the sequence without giving the final answer: 1. For the first word (the animal), explain how the animal is typically associated with a specific characteristic (e.g., its color, habitat, or a notable feature). 2. For the second word (the fruit), describe how the fruit shares this same characteristic or feature with the animal. 3. For the third word (the color), explain why this color can be connected to both the animal and fruit. For each sequence, provide clues based on the specific animal, fruit, and color mentioned. Do not give away the final answer.
Do NOT give away the final sequence. Offer clues that help the user think creatively and make the connection themselves. 1. For the animal, provide clues related to its unique characteristics (e.g., its size, habitat, or color). 2. For the fruit, provide clues that relate to how it shares a feature with the animal (e.g., color, texture, shape, or taste). 3. For the color, provide clues about why this color ties both the animal and the fruit together.
Focus on generating unique reasoning for each specific input and make the clues related to the particular animal, fruit, and color.
Now, help me think through this sequence: "{message}" """11 unmodified lines token = message.choices[0].delta.content response += token
# Ensure that the response focuses on clues, not the sequence # Limit the response to dynamic reasoning and avoid repeating the same structure if len(response.split()) > 50: # Prevent long explanations response = """ 1. Think about how the animal is typically associated with a specific characteristic, such as color, habitat, or shape. 2. Consider how the fruit shares a similar characteristic or feature with the animal. 3. Finally, think about the color that ties both the animal and the fruit together. """ response = response.strip()
yield response
1 unmodified linedemo = gr.ChatInterface( respond, additional_inputs=[ gr.Textbox(value="You are a chatbot that helps users think through the connections between an animal, a fruit, and a color. Provide reasoning and clues, but do not reveal the final sequence.", label="System message"), gr.Textbox(value="You are a chatbot that helps users think creatively through sequences of words. Provide reasoning and clues, but do not reveal 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(8 unmodified lines
if __name__ == "__main__": demo.launch()
app.py+10-16