Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -8,17 +8,12 @@ from huggingface_hub import hf_hub_download #load from huggingfaces
|
|
8 |
|
9 |
llm = Llama(model_path= hf_hub_download(repo_id="TheBloke/airoboros-l2-13b-gpt4-m2.0-GGML", filename="airoboros-l2-13b-gpt4-m2.0.ggmlv3.q6_K.bin"), n_ctx=2048) #download model from hf/ n_ctx=2048 for high ccontext length
|
10 |
|
11 |
-
history =
|
12 |
-
history.append(["Q: Hi there!, why is the sky blue?", " A:Hello! The blue color of the sky is a fascinating natural phenomenon caused by the way Earth's atmosphere interacts with sunlight. Here's a simple explanation of why the sky appears blue: Sunlight: The sun emits white light, which is a combination of all colors in the visible spectrum. Scattering: As sunlight enters Earth's atmosphere, it encounters tiny particles and molecules, such as nitrogen and oxygen, that make up the air. These particles scatter the sunlight in all directions. Rayleigh Scattering: The scattering of sunlight is not uniform for all colors. Shorter wavelengths of light (blue and violet) are scattered more effectively by the molecules in the atmosphere compared to longer wavelengths (red, orange, and yellow). Dominant Blue: Since blue light is scattered more than other colors, it becomes more visible in the sky. As a result, when you look up during the day, you see the scattered blue light coming from all directions, giving the sky its blue appearance. Absorption: Other colors of sunlight, especially reds and oranges, are scattered less and tend to pass through the atmosphere more directly or are absorbed by the gases and particles in the atmosphere. That's why we see blue during the day but often witness beautiful red and orange hues during sunrise and sunset when the sunlight has to travel through a thicker layer of the atmosphere.It's worth noting that the sky may appear different colors under certain conditions, such as during sunrise and sunset when the angle of sunlight is different, or in regions with different atmospheric compositions. However, the typical blue color is the result of this scattering phenomenon in Earth's atmosphere."])
|
13 |
-
|
14 |
|
15 |
def generate_text(input_text, history):
|
16 |
full_conversation = f"{history} Q: {input_text} \n A:"
|
17 |
output = llm(full_conversation, max_tokens=1024, stop=["Q:", "\n"], echo=True)
|
18 |
response = output['choices'][0]['text']
|
19 |
-
history.append([input_text, response])
|
20 |
-
conversation_context = " ".join([f"{pair[0]} {pair[1]}" for pair in history])
|
21 |
-
print(conversation_context)
|
22 |
return response
|
23 |
|
24 |
|
|
|
8 |
|
9 |
llm = Llama(model_path= hf_hub_download(repo_id="TheBloke/airoboros-l2-13b-gpt4-m2.0-GGML", filename="airoboros-l2-13b-gpt4-m2.0.ggmlv3.q6_K.bin"), n_ctx=2048) #download model from hf/ n_ctx=2048 for high ccontext length
|
10 |
|
11 |
+
history = ""
|
|
|
|
|
12 |
|
13 |
def generate_text(input_text, history):
|
14 |
full_conversation = f"{history} Q: {input_text} \n A:"
|
15 |
output = llm(full_conversation, max_tokens=1024, stop=["Q:", "\n"], echo=True)
|
16 |
response = output['choices'][0]['text']
|
|
|
|
|
|
|
17 |
return response
|
18 |
|
19 |
|