Update app.py
Browse files
    	
        app.py
    CHANGED
    
    | @@ -15,6 +15,7 @@ def read(filename): | |
| 15 |  | 
| 16 | 
             
            SYS_PROMPT = read('system_prompt.txt')
         | 
| 17 |  | 
|  | |
| 18 |  | 
| 19 | 
             
            DESCRIPTION = '''
         | 
| 20 | 
             
            <div>
         | 
| @@ -51,13 +52,15 @@ def process_text(text_input, unit): | |
| 51 | 
             
                    system=f"You are a experienced {unit} doctor AI assistant." + SYS_PROMPT,
         | 
| 52 | 
             
                    api_name="/model_chat"
         | 
| 53 | 
             
                )
         | 
| 54 | 
            -
                 | 
|  | |
|  | |
| 55 | 
             
                print(response)
         | 
| 56 | 
             
                return response[1][0][0]
         | 
| 57 |  | 
| 58 | 
             
            def process_image(image_input, unit):
         | 
| 59 | 
             
                if image_input is not None:
         | 
| 60 | 
            -
                    image = str(image_input)
         | 
| 61 | 
             
                    print(image_input,image)
         | 
| 62 | 
             
                    #with open(image_input, "rb") as f:
         | 
| 63 | 
             
                    #   base64_image = base64.b64encode(f.read()).decode("utf-8")
         | 
|  | |
| 15 |  | 
| 16 | 
             
            SYS_PROMPT = read('system_prompt.txt')
         | 
| 17 |  | 
| 18 | 
            +
            ABS_URL = "https://orrinin-hcare.hf.space/file="
         | 
| 19 |  | 
| 20 | 
             
            DESCRIPTION = '''
         | 
| 21 | 
             
            <div>
         | 
|  | |
| 52 | 
             
                    system=f"You are a experienced {unit} doctor AI assistant." + SYS_PROMPT,
         | 
| 53 | 
             
                    api_name="/model_chat"
         | 
| 54 | 
             
                )
         | 
| 55 | 
            +
                while not job.done():
         | 
| 56 | 
            +
                    time.sleep(0.1)
         | 
| 57 | 
            +
                response = job.outputs()
         | 
| 58 | 
             
                print(response)
         | 
| 59 | 
             
                return response[1][0][0]
         | 
| 60 |  | 
| 61 | 
             
            def process_image(image_input, unit):
         | 
| 62 | 
             
                if image_input is not None:
         | 
| 63 | 
            +
                    image = str(ABS_URL + image_input)
         | 
| 64 | 
             
                    print(image_input,image)
         | 
| 65 | 
             
                    #with open(image_input, "rb") as f:
         | 
| 66 | 
             
                    #   base64_image = base64.b64encode(f.read()).decode("utf-8")
         | 
