Spaces:
				
			
			
	
			
			
		Configuration error
		
	
	
	
			
			
	
	
	
	
		
		
		Configuration error
		
	Update app.py
Browse files
    	
        app.py
    CHANGED
    
    | @@ -102,6 +102,7 @@ def send_selected_story(title, model_name, system_prompt): | |
| 102 | 
             
                data = []  # Reset data for new story
         | 
| 103 | 
             
                tokenizer, model = load_model(model_name)
         | 
| 104 | 
             
                selected_story = title
         | 
|  | |
| 105 | 
             
                for story in stories:
         | 
| 106 | 
             
                    if story["title"] == title:
         | 
| 107 | 
             
                        system_prompt = f"""
         | 
| @@ -111,6 +112,7 @@ Here is the story: | |
| 111 | 
             
            {story['story']}
         | 
| 112 | 
             
            ---
         | 
| 113 | 
             
                        """
         | 
|  | |
| 114 | 
             
                        combined_message = system_prompt.strip()
         | 
| 115 | 
             
                        if combined_message:
         | 
| 116 | 
             
                            chat_history = []  # Reset chat history
         | 
| @@ -120,7 +122,7 @@ Here is the story: | |
| 120 | 
             
                            question_prompt = "Please ask a simple question about the story to encourage interaction."
         | 
| 121 | 
             
                            _, formatted_history, chat_history = interact(question_prompt, chat_history)
         | 
| 122 |  | 
| 123 | 
            -
                            return formatted_history, chat_history, gr.update(value= | 
| 124 | 
             
                        else:
         | 
| 125 | 
             
                            print("Combined message is empty.")
         | 
| 126 | 
             
                    else:
         | 
|  | |
| 102 | 
             
                data = []  # Reset data for new story
         | 
| 103 | 
             
                tokenizer, model = load_model(model_name)
         | 
| 104 | 
             
                selected_story = title
         | 
| 105 | 
            +
                story_text = ""
         | 
| 106 | 
             
                for story in stories:
         | 
| 107 | 
             
                    if story["title"] == title:
         | 
| 108 | 
             
                        system_prompt = f"""
         | 
|  | |
| 112 | 
             
            {story['story']}
         | 
| 113 | 
             
            ---
         | 
| 114 | 
             
                        """
         | 
| 115 | 
            +
                        story_text = story["story"]
         | 
| 116 | 
             
                        combined_message = system_prompt.strip()
         | 
| 117 | 
             
                        if combined_message:
         | 
| 118 | 
             
                            chat_history = []  # Reset chat history
         | 
|  | |
| 122 | 
             
                            question_prompt = "Please ask a simple question about the story to encourage interaction."
         | 
| 123 | 
             
                            _, formatted_history, chat_history = interact(question_prompt, chat_history)
         | 
| 124 |  | 
| 125 | 
            +
                            return formatted_history, chat_history, gr.update(value=story_text), gr.update(value=[])  # Reset the data table
         | 
| 126 | 
             
                        else:
         | 
| 127 | 
             
                            print("Combined message is empty.")
         | 
| 128 | 
             
                    else:
         |