File size: 2,510 Bytes
5959d96
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
184da28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import gradio as gr
from transformers import AutoModelForCausalLM, AutoTokenizer
from gtts import gTTS
import os

# Load Mistral 7B Chat Model
model_name = "mistralai/Mistral-7B-Instruct"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)

# Function to generate AI response
def chatbot_response(user_input):
    inputs = tokenizer(user_input, return_tensors="pt")
    outputs = model.generate(**inputs, max_length=200)
    response = tokenizer.decode(outputs[0], skip_special_tokens=True)
    return response

# Function to convert AI response to speech
def text_to_speech(text):
    tts = gTTS(text=text, lang="en")
    filename = "response.mp3"
    tts.save(filename)
    return filename

# Gradio Interface
def chat_interface(user_input):
    ai_response = chatbot_response(user_input)
    audio_file = text_to_speech(ai_response)
    return ai_response, audio_file

# Launch Gradio UI
demo = gr.Interface(
    fn=chat_interface,
    inputs=gr.Textbox(label="Ask ZEAL.AI"),
    outputs=[gr.Textbox(label="AI Response"), gr.Audio(label="Text-to-Speech Output")],
    title="ZEAL.AI - Bible AI Chatbot",
    description="Ask anything and get a spoken response!"
)

demo.launch()

```

## Installation (Local)

To run **Moodly** locally, follow these steps:

1. Clone the repository:

   ```bash
   git clone https://github.com/RummyAx/Mood-Parser.git
   ```

2. Install required libraries:

   ```bash
   pip install -r requirements.txt
   ```

3. Run the model:

   ```bash
   python app.py
   ```

This will allow you to use the model on your local machine.

## Contributing

We welcome contributions to this project! To contribute:

1. Fork the repository
2. Create a new branch (`git checkout -b feature-branch`)
3. Commit your changes (`git commit -am 'Add new feature'`)
4. Push to the branch (`git push origin feature-branch`)
5. Create a Pull Request

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Acknowledgments

- Hugging Face for providing the platform and hosting the model.
- The authors of BERT and RoBERTa for their powerful transformer models.
- The open-source community for their contributions to NLP.
```

This updated README reflects the correct repository name `RummyAx/Mood-Parser` and includes links and API usage instructions for your Hugging Face project. Make sure to replace the `YOUR_HUGGINGFACE_API_KEY` placeholder with your actual Hugging Face API key.