Spaces:
				
			
			
	
			
			
		Sleeping
		
	
	
	
			
			
	
	
	
	
		
		
		Sleeping
		
	Update app.py
Browse files
    	
        app.py
    CHANGED
    
    | @@ -1,9 +1,12 @@ | |
| 1 | 
             
            import gradio as gr
         | 
| 2 | 
             
            import requests
         | 
|  | |
| 3 |  | 
| 4 | 
             
            API_URL = "https://api-inference.huggingface.co/models/meta-llama/Meta-Llama-3-8B-Instruct"
         | 
| 5 | 
             
            headers = {"Authorization": "Bearer hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}
         | 
| 6 |  | 
|  | |
|  | |
| 7 | 
             
            def analyze_sentiment(text):
         | 
| 8 | 
             
                payload = {
         | 
| 9 | 
             
                    "inputs": f"Analyze the sentiment of the following text and respond with either 'heureux' or 'malheureux': {text}"
         | 
|  | |
| 1 | 
             
            import gradio as gr
         | 
| 2 | 
             
            import requests
         | 
| 3 | 
            +
            import spaces 
         | 
| 4 |  | 
| 5 | 
             
            API_URL = "https://api-inference.huggingface.co/models/meta-llama/Meta-Llama-3-8B-Instruct"
         | 
| 6 | 
             
            headers = {"Authorization": "Bearer hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}
         | 
| 7 |  | 
| 8 | 
            +
            @spaces.GPU
         | 
| 9 | 
            +
             | 
| 10 | 
             
            def analyze_sentiment(text):
         | 
| 11 | 
             
                payload = {
         | 
| 12 | 
             
                    "inputs": f"Analyze the sentiment of the following text and respond with either 'heureux' or 'malheureux': {text}"
         |