Upload app.py
Browse files
app.py
CHANGED
|
@@ -1,36 +1,4 @@
|
|
| 1 |
-
# -*- coding: utf-8 -*-
|
| 2 |
-
"""app.ipynb
|
| 3 |
|
| 4 |
-
Automatically generated by Colab.
|
| 5 |
-
|
| 6 |
-
Original file is located at
|
| 7 |
-
https://colab.research.google.com/drive/14vp_MnMkFmCm_l4xkpQa0lIN07A4Z1RQ
|
| 8 |
-
"""
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
"""# Task
|
| 13 |
-
Develop a Gradio application with a chatbot tab that uses a conversational model from Hugging Face to interact with users.
|
| 14 |
-
|
| 15 |
-
## Set up the environment
|
| 16 |
-
|
| 17 |
-
### Subtask:
|
| 18 |
-
Install the necessary libraries, such as `transformers` and `gradio`.
|
| 19 |
-
|
| 20 |
-
**Reasoning**:
|
| 21 |
-
The subtask requires installing the `transformers` and `gradio` libraries. I will use pip to install both libraries in a single code block.
|
| 22 |
-
"""
|
| 23 |
-
|
| 24 |
-
!pip install transformers gradio
|
| 25 |
-
|
| 26 |
-
"""## Load the model and tokenizer
|
| 27 |
-
|
| 28 |
-
### Subtask:
|
| 29 |
-
Choose a suitable conversational model from Hugging Face and load it along with its tokenizer.
|
| 30 |
-
|
| 31 |
-
**Reasoning**:
|
| 32 |
-
Import the necessary classes and load the chosen conversational model and its tokenizer from Hugging Face.
|
| 33 |
-
"""
|
| 34 |
|
| 35 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 36 |
|
|
|
|
|
|
|
|
|
|
| 1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 4 |
|