Giter VIP home page Giter VIP logo

Comments (6)

jainishmehta avatar jainishmehta commented on July 18, 2024 2

Hey, I fixed it. I had to do gradio==4.8.0 and change to "
label = gr.Label(num_top_classes=5)"

from healifyai--llm-based-healthcare-system.

tanvir-ishraq avatar tanvir-ishraq commented on July 18, 2024 1

@jainishmehta
Gradio package is possibly bringing in changes. Pretty recent.

GradioDeprecationWarning: Usage of gradio.outputs is deprecated, and will not be supported in the future, please import your components from gradio.components

Did you use/follow the requirements.txt of the project? As it is stated,
gradio==3.34.0
As always remember the python best practice of using virtual environment for installing packages.

from healifyai--llm-based-healthcare-system.

tanvir-ishraq avatar tanvir-ishraq commented on July 18, 2024 1

I directly deployed on huggingface where there was no issue. So, I am sure it is supposed to work locally which is what you are doing. I am sharing requirements.txt of huggingface directly here. Try installing that on a fresh virtual environment:

gradio==3.34.0
gradio_client==0.2.6
ohmeow-blurr==1.0.5
torch==1.13.1
transformers==4.33.2

In the upcoming days I will check the app code locally if possible in my free time.

from healifyai--llm-based-healthcare-system.

jainishmehta avatar jainishmehta commented on July 18, 2024

thanks :)

from healifyai--llm-based-healthcare-system.

jainishmehta avatar jainishmehta commented on July 18, 2024

I use this code on your app.py now:

import gradio as gr
from transformers import AutoTokenizer
import torch, json

from fastai.text.all import *
from blurr.text.modeling.all import *

from blurr.text.data.all import *
from fastai.vision.all import *

with open('question_labels.json', 'r') as f:
question_dictionary = json.load(f)
que_classes = list(question_dictionary.keys())

blurr_model = load_learner('healifyLLM-stage4.pkl')
probs = blurr_model.blurr_predict('headache')[0]['probs']
values_and_probs = dict(zip(que_classes, map(float, probs)))
print(sorted(values_and_probs.items(), key=lambda x: x[1], reverse=True)[:5])

def detect_question(text):
blurr_model = load_learner('healifyLLM-stage4.pkl')
probs = blurr_model.blurr_predict(text)[0]['probs']
values_and_probs = dict(zip(que_classes, map(float, probs)))
return dict(sorted(values_and_probs.items(), key=lambda x: x[1], reverse=True))

label = gr.outputs.Label(num_top_classes=5)
iface = gr.Interface(fn=detect_question, inputs="text", outputs = label)
if name == "main":
iface.launch(show_api=False)

Screenshot from 2023-11-24 16-34-22
I get the right values from your model (so the model is not the issue)
however I keep getting error:
Screenshot from 2023-11-24 16-35-22

from healifyai--llm-based-healthcare-system.

tanvir-ishraq avatar tanvir-ishraq commented on July 18, 2024

That’s fantastic news! πŸŽ‰
I think I will bring a second update to the HuggingFace gradio app soon, to make it a bit more interactive. Feel free to check it out.

from healifyai--llm-based-healthcare-system.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.