Spaces:
				
			
			
	
			
			
		Runtime error
		
	
	
	
			
			
	
	
	
	
		
		
		Runtime error
		
	Create app.py
Browse files
    	
        app.py
    ADDED
    
    | @@ -0,0 +1,24 @@ | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | 
|  | |
| 1 | 
            +
            from transformers import pipeline
         | 
| 2 | 
            +
            import gradio as gr
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            models = {
         | 
| 5 | 
            +
                'devngho/ko_edu_classifier_v2_lemon-mint_LaBSE-EnKo-Nano-Preview-v0.3': pipeline("text-classification", model="devngho/ko_edu_classifier_v2_lemon-mint_LaBSE-EnKo-Nano-Preview-v0.3"),
         | 
| 6 | 
            +
                'devngho/ko_edu_classifier_v2_LaBSE': pipeline("text-classification", model="devngho/ko_edu_classifier_v2_LaBSE")
         | 
| 7 | 
            +
            }
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            import gradio as gr
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            def evaluate_model(input_text):
         | 
| 12 | 
            +
                return [model(input_text) for model in models.values()]
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            # Gradio interface
         | 
| 15 | 
            +
            with gr.Blocks() as demo:
         | 
| 16 | 
            +
                input_text = gr.Textbox(label="Input Text")
         | 
| 17 | 
            +
                submit_button = gr.Button("Evaluate")
         | 
| 18 | 
            +
                output_scores = [gr.Number(f'Score by {name}') for name in models.keys()]
         | 
| 19 | 
            +
                
         | 
| 20 | 
            +
                # Action to perform on button click
         | 
| 21 | 
            +
                submit_button.click(evaluate_model, inputs=input_text, outputs=output_scores)
         | 
| 22 | 
            +
             | 
| 23 | 
            +
            # Launch the app
         | 
| 24 | 
            +
            demo.launch()
         | 
