Spaces:
				
			
			
	
			
			
		Runtime error
		
	
	
	
			
			
	
	
	
	
		
		
		Runtime error
		
	Update app.py
Browse files
    	
        app.py
    CHANGED
    
    | @@ -92,12 +92,12 @@ def generate(prompt, history,max_new_tokens,health,temperature=temperature,top_p | |
| 92 | 
             
                )
         | 
| 93 | 
             
                #history=""
         | 
| 94 | 
             
                #formatted_prompt2 = format_prompt(f"{ADJUST_STATS.format(history=output,health=health)}, {prompt}", history)
         | 
| 95 | 
            -
                stream2 = client.text_generation(f"{ADJUST_STATS.format(history=output,health=health)}", **generate_kwargs2, stream=True, details=True, return_full_text=False)  
         | 
| 96 | 
            -
                output2=""
         | 
| 97 | 
            -
                for response in stream2:
         | 
| 98 | 
            -
             | 
| 99 |  | 
| 100 | 
            -
                lines =  | 
| 101 | 
             
                for i,line in enumerate(lines):
         | 
| 102 | 
             
                    if line.startswith("Health: "):
         | 
| 103 | 
             
                        try:
         | 
| @@ -106,7 +106,7 @@ def generate(prompt, history,max_new_tokens,health,temperature=temperature,top_p | |
| 106 | 
             
                            print(health)
         | 
| 107 | 
             
                        except Exception as e:
         | 
| 108 | 
             
                            print (f'{health}--Error :: {e}')
         | 
| 109 | 
            -
                    if line.startswith(" | 
| 110 | 
             
                        print(line)
         | 
| 111 | 
             
                    if line.startswith("3. "):
         | 
| 112 | 
             
                        print(line)
         | 
|  | |
| 92 | 
             
                )
         | 
| 93 | 
             
                #history=""
         | 
| 94 | 
             
                #formatted_prompt2 = format_prompt(f"{ADJUST_STATS.format(history=output,health=health)}, {prompt}", history)
         | 
| 95 | 
            +
                #stream2 = client.text_generation(f"{ADJUST_STATS.format(history=output,health=health)}", **generate_kwargs2, stream=True, details=True, return_full_text=False)  
         | 
| 96 | 
            +
                #output2=""
         | 
| 97 | 
            +
                #for response in stream2:
         | 
| 98 | 
            +
                #    output2 += response.token.text
         | 
| 99 |  | 
| 100 | 
            +
                lines = output.strip().strip("\n").split("\n")
         | 
| 101 | 
             
                for i,line in enumerate(lines):
         | 
| 102 | 
             
                    if line.startswith("Health: "):
         | 
| 103 | 
             
                        try:
         | 
|  | |
| 106 | 
             
                            print(health)
         | 
| 107 | 
             
                        except Exception as e:
         | 
| 108 | 
             
                            print (f'{health}--Error :: {e}')
         | 
| 109 | 
            +
                    if line.startswith("Power: "):
         | 
| 110 | 
             
                        print(line)
         | 
| 111 | 
             
                    if line.startswith("3. "):
         | 
| 112 | 
             
                        print(line)
         | 
