Spaces:
				
			
			
	
			
			
		Runtime error
		
	
	
	
			
			
	
	
	
	
		
		
		Runtime error
		
	Commit 
							
							·
						
						0086049
	
1
								Parent(s):
							
							8748a70
								
Update app.py
Browse files
    	
        app.py
    CHANGED
    
    | 
         @@ -1,17 +1,7 @@ 
     | 
|
| 1 | 
         
            -
            from pathlib import Path
         
     | 
| 2 | 
         
            -
            from typing import List, Dict, Tuple
         
     | 
| 3 | 
         
            -
             
     | 
| 4 | 
         
            -
            import seaborn as sns
         
     | 
| 5 | 
         
            -
            from shiny import App, Inputs, Outputs, Session, reactive, render, req, ui
         
     | 
| 6 | 
         
            -
             
     | 
| 7 | 
         
             
            from transformers import AutoTokenizer, AutoModelForSequenceClassification
         
     | 
| 8 | 
         
             
            from transformers import TextClassificationPipeline
         
     | 
| 9 | 
         | 
| 10 | 
         
            -
             
     | 
| 11 | 
         
            -
             
     | 
| 12 | 
         
            -
            www_dir = Path(__file__).parent.resolve() / "www"
         
     | 
| 13 | 
         
            -
             
     | 
| 14 | 
         
            -
            def server(input: Inputs, output: Outputs, session: Session):
         
     | 
| 15 | 
         
             
                model_name = 'lincoln/flaubert-mlsum-topic-classification'
         
     | 
| 16 | 
         | 
| 17 | 
         
             
                loaded_tokenizer = AutoTokenizer.from_pretrained(model_name)
         
     | 
| 
         @@ -23,5 +13,7 @@ def server(input: Inputs, output: Outputs, session: Session): 
     | 
|
| 23 | 
         | 
| 24 | 
         | 
| 25 | 
         
             
            app = App(
         
     | 
| 
         | 
|
| 26 | 
         
             
                Inputs = "Le Bayern Munich prend la grenadine.",
         
     | 
| 27 | 
         
            -
                 
     | 
| 
         | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 1 | 
         
             
            from transformers import AutoTokenizer, AutoModelForSequenceClassification
         
     | 
| 2 | 
         
             
            from transformers import TextClassificationPipeline
         
     | 
| 3 | 
         | 
| 4 | 
         
            +
            def classification(input: Inputs):
         
     | 
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 
         | 
|
| 5 | 
         
             
                model_name = 'lincoln/flaubert-mlsum-topic-classification'
         
     | 
| 6 | 
         | 
| 7 | 
         
             
                loaded_tokenizer = AutoTokenizer.from_pretrained(model_name)
         
     | 
| 
         | 
|
| 13 | 
         | 
| 14 | 
         | 
| 15 | 
         
             
            app = App(
         
     | 
| 16 | 
         
            +
                print('Processing')
         
     | 
| 17 | 
         
             
                Inputs = "Le Bayern Munich prend la grenadine.",
         
     | 
| 18 | 
         
            +
                classification(Inputs)
         
     | 
| 19 | 
         
            +
            )
         
     |